How To Install And Set up React on macOS X

react-macos
macOS ReactLeave a Comment on How To Install And Set up React on macOS X

How To Install And Set up React on macOS X

We know that React is getting more popular among developers nowadays. It is a JavaScript library which is easy to learn and code. It also enables the feature of reusability of components which significantly reduces the number of lines in our project.

React is maintained by Facebook and a community of individual developers and companies. React can be used as a base for the development of single-page or mobile applications. It is a powerful library to deal with complex projects in an easy manner. React Native, one of the most lovable hybrid mobile application development frameworks is also based on React.

Here I am going to explain the installation and setting up of React on macOS X Operating System.

1. Install and Update Homebrew

Homebrew is a popular package manager for macOS. We can install all the packages and dependencies required to install React using Homebrew. So at first, we need to install it on our system.

To install Homebrew, open the Terminal and run the command below.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

So we have installed Homebrew on our system successfully and now we need to update it so that we can get the latest version of packages available on HomeBrew.

brew update

2. Install Nodejs

In this tutorial, we are going to install Angular 8 using the Node Package Manager(NPM). So first, we need to install Nodejs on our system. NPM will be installed with Nodejs itself.

Nodejs can be installed on our system using the below brew command.

brew install node

Alternative method

Alternatively, we can download and install Nodejs from the official website. If so, it does not need Homebrew to be installed on our system.

Currently, 12.7.0 is the latest version of Nodejs and it can be downloaded and installed on our system using the URL below.

 https://nodejs.org/en/download/current/ 

Select the macOS installer option and download the node-v12.7.0.pkg file. Then install it on our system.


3. Install Create-React-App Tool

Now we need to install a tool named create-react-app using NPM as global. We can create react applications using this tool easily.

npm install -g create-react-app

4. Creating a New React Project

After successful installation of create-react-app, we can create our first react application using it.

create-react-app awesome-project

Here awesome-project is the name I have chosen for my react project.

Note:-

We can also combine the steps 3 and 4 with a single command using NPX( package runner tool that comes with NPM 5.2+).

npx create-react-app awesome-project

Here NPX will temporarily install create-react-app and create a new react project named awesome-project.

5. Running the Application

The app we created can be run locally on our system.

cd awesome-project
npm start

This will opens up the react application in a new tab of our browser with the below URL.

http://localhost:3000

Have a nice code!

Hi, I'm Syamlal, the co-founder of Redmonark. I'm a developer, writer and also have a little bit of experience in graphic designing.
Website https://syam.me

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top
%d bloggers like this: