Mac OS has Homebrew package manager which works like a dependency manager, using it you can install Node JS and NPM in your Mac OS m1 or m2 system. In this tutorial, we will show you how to install node js and npm and verify it on Mac OS M1 or M2 using Homebrew.
How to Install Node.js and npm on Mac OS M1 or M2 using Homebrew
To install Node.js and NPM on Mac OS M1 or M2 using Homebrew, you can follow these steps:
- Step 1: Download and Install & Update Homebrew
- Step 2: Install Node.js
- Step 3: Verify Node.js Installation
- Step 4: Install npm
- Step 5: Verify npm Installation
Step 1: Download and Install Homebrew
Homebrew is a package manager for Mac OS, which helps in installing dependencies. Using this, we can install Homebrew on Mac OS system:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once installed homebrew, run brew update
to make sure Homebrew is up to date:
brew update
Step 2: Install Node.js
Now, let’s install node.js on mac os m1 or m2 using brew install node command, run the command:
brew install node
This will download and install the latest version of Node.js on your macOS system.
Step 3: Verify Node.js Installation
If you have installed nodejs using brew install node command. Verify the installation of your node.js, use the below-given command:
node -v
Step 4: Install npm
Now you can install npm with the help of brew command. Which is given below:
brew install npm
Step 5: Verify npm Installation
By running npm -v command on terminal or cmd to check npm is install or not:
npm -v
This command will show you the version of npm.
Conclusion
That’s it! You have successfully installed Node.js and npm on your macOS system. You can now start developing and building fast and scalable applications in JavaScript with Node.js.