How to install NodeJS and NPM on Mac using Homebrew

How to install NodeJS and NPM on Mac using Homebrew

Image for post

Step 1: Install Homebrew

Homebrew is the missing package manager for macOS.

Paste the following in a macOS Terminal prompt.

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

This will install Homebrew on your Mac. To check the version type the following command.

$ brew -v

Step 2: Install Node via Homebrew

Type following command to install node

$ brew install node

check the Node and NPM version.

$node -vv12.7.0

To check npm version

$npm -v6.10.0

If it?s showing the version installed, you?re done!!

To install specific Node version

  1. To unlink from current version

$ brew unlink node

2. Install any version

$ brew install node@6 //To install version 6

To link installed version

$ brew link node@6

To check your current node version, Type

$ node –version

16