Setup React On Mac In Less Than 10 Minutes

Sonar Systems
3 min readMay 4, 2023

--

https://static.codingforentrepreneurs.com/media/cfe-blog/setup-react/setup_reactjs_logo.jpg

Setting up React on a Mac is a straightforward process that involves installing Node.js, a package manager such as npm or Yarn, and then creating a new React project using the create-react-app command-line tool. Here are the steps to follow:

1: Install Node.js:

Node.js is a runtime environment that allows you to run JavaScript code outside of a web browser. React is built on top of Node.js, so you need to install it on your machine before you can start developing with React.

To install Node.js on your Mac, follow these steps:

  • Go to the Node.js website (https://nodejs.org/en/) in your web browser.
  • Click on the “Download” button for the “Recommended For Most Users” version of Node.js, which will download a .pkg file to your Mac.
  • Once the download is complete, double-click on the .pkg file to run the installer.
  • Follow the on-screen instructions to complete the installation.

2: Install a package manager:

A package manager is a tool that allows you to install, manage, and update packages (i.e., libraries and frameworks) for Node.js. The two most popular package managers for Node.js are npm and Yarn.

If you have installed Node.js using the official installer, npm should already be installed on your machine. To check if npm is installed, open the Terminal app on your Mac and type npm -v and press Enter. If you see a version number, then npm is installed. If not, you can install it by running the following command in the Terminal: npm install -g npm.

Alternatively, you can install Yarn by following the instructions on the Yarn website (https://yarnpkg.com/lang/en/docs/install/).

3: Install create-react-app:

create-react-app is a command-line tool that automates the process of creating a new React project. To install create-react-app, open the Terminal app on your Mac and run the following command: npm install -g create-react-app. This command will download and install create-react-app globally on your machine, which means you'll be able to use it from anywhere in your system.

4: Create a new React project:

Now that you have create-react-app installed, you can use it to create a new React project. To do so, navigate to the directory where you want to create the project using the cd command. For example, if you want to create the project in your Documents folder, you can run the following command: cd ~/Documents.

Once you are in the desired directory, run the following command to create a new React project called my-app: create-react-app my-app. This command will create a new directory called my-app and populate it with the files and folders needed for a basic React project.

5: Start the development server:

Now that you have a new React project set up, you can start the development server to view your project in a web browser. To do so, navigate into the project directory by running the following command in the Terminal: cd my-app.

Once you are in the project directory, run the following command to start the development server: npm start. This command will start the server and open a new browser window with your React app.

That’s it! You have successfully set up React on your Mac and created a new React project. From here, you can start building your React app by modifying the files in the src directory of your project.

If you have installed Node.js using the official installer, npm should already be installed on your machine. To check if npm is installed, open the Terminal app on your Mac and type npm -v and press Enter. If you see a version number, then npm is installed. If not, you can install it by running the following command in the Terminal: npm install -g npm.

Alternatively, you can install Yarn by following the instructions on the Yarn website (https://yarnpkg.com/lang/en/docs/install/).

--

--

Sonar Systems

It's simple we want to create what we can proudly share with others :D