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.
If you have Brew installed, skip this step.
Open your terminal and run the below command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
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)... Password: ==> This script will install: /opt/homebrew/bin/brew /opt/homebrew/share/doc/homebrew /opt/homebrew/share/man/man1/brew.1 /opt/homebrew/share/zsh/site-functions/_brew /opt/homebrew/etc/bash_completion.d/brew /opt/homebrew 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: https://docs.brew.sh/Analytics 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: https://github.com/Homebrew/brew#donations ==> 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: https://docs.brew.sh
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
Now, using the brew package manager, install the
brew install node
Install the watchman package. It helps the React developer to focus on managing the files during the web application development process.
brew install watchman
Install the command line interface for the react-native.
npm install -g react-native-cli
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.