The Best Way to Install Node.js, npm and yarn on Mac OSX

The best way to install Node.js on Mac is nvm.

You can use the install script for nvm installation.

$ curl -o- | bash

relaunch your Terminals and check nvm version

$ nvm --version

List your installed node versions if any:

$ nvm list

It is safe if you choose one of the most recent LTS (long time support) versions and install it with the following command:

$ nvm install --lts

Or if you want to install any specific LTS version use below to install that.

$ nvm install <node-version>

So if the latest LTS version of Node is 10.15.3

$ nvm install 10.15.3

Setup this version as the default.

$ nvm use <node-version>

Check your node version with

$ node -v

In case, you want to upgrade node

$ nvm install <node-version> --reinstall-packages-from=<old-node-version>

To Uninstall Node

$ nvm uninstall <node-version>

Switching between various nodes versions

$ nvm use <node-version>
$ nvm use node (switch to latest Node.js version)


npm is installed as a package with Node

Check the version

$ npm -v

To upgrade npm

$ npm install -g npm@latest


To install yarn

$ npm install -g yarn

Check the version

$ yarn -v



Digital Nomad (

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store