How to Install React-Native on Your Mac?

How to Install React-Native on Your Mac?

It just takes simple 5 steps to install react-native on your Mac system.

To install react native on your Mac, you need the Brew package manager. You can install it with a simple command.

Step 1. Install Brew / Homebrew

If you have Brew installed, skip this step.

Open your terminal and run the below command.

/bin/bash -c "$(curl -fsSL"

Make sure your internet connection is turned on and working.

To install an app, you need administrative privilege. I will be asked to enter the password.

It will take some time to install. You can see the steps and progress.

==> Checking for `sudo` access (which may request your password)...
==> This script will install:

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R :admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at 66c6e5b5f Merge pull request #15582 from Bo98/no-api-migrate
Warning: /opt/homebrew/bin is not in your PATH.
  Instructions on how to configure your shell for Homebrew
  can be found in the 'Next steps' section below.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
No analytics data has been sent yet (nor will any be during this install run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:

==> Next steps:
- Run this command in your terminal to add Homebrew to your PATH:
    eval "$(/opt/homebrew/bin/brew shellenv)"
- Run brew help to get started
- Further documentation:

As mentioned above, you have to add Homebrew to your system path. Run the below command.

eval "$(/opt/homebrew/bin/brew shellenv)"

If you don’t set the Homebrew path, your brew command will not be recognized and you will get an error, as…

-bash: brew: command not found

But you need to run the eval command every time you open the terminal.

To avoid that…

In your terminal, edit the .zshrc file (which is located in the home directory) by running the below command.

nano ~/.zshrc

Add the following line of code at the end of the file.

eval "$(/opt/homebrew/bin/brew shellenv)"

Save the file and exit. (Ctrl+x, and then y and then Enter).

Now, you don’t have to run the eval command. It will be executed automatically when you open the terminal.

Step 2. Install node.js

Now, using the brew package manager, install the node.js package.

brew install node

Step 3. Install watchman

Install the watchman package. It helps the React developer to focus on managing the files during the web application development process.

brew install watchman

Step 4. Install React Native CLI

Install the command line interface for the react-native.

npm install -g react-native-cli

Step 5. Create the First React Native Project on Mac

It’s time now to create your first project. The command is very simple and self-descriptive.

react-native init <ProjectName>

Congratulation! You have created your first react-native app with just simple 5 steps.

If you find any error while executing the above commands, share it with me in the comment section below.

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *