How to install nodejs in macos

In this article, we will see how to install nodejs in macos. How to Install/Update Nodejs in Mac OSX.

Recent Articles,

TypeScript for React developers in 2020

Implement Multi Threading in Nodejs with a real world use-case

A Complete Guide to AWS Elastic Load Balancer using Nodejs

Basically there are few methods to install Nodejs in Mac. they are,

Using Node version Manager(nvm)

Firstly install the nvm in your machine using the command

1curl -o- | bash

the above command downloads the binary and stores it in ~/.nvm. Now you need to add the variable in the bash profile.


and add the following code in the profile

1export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
2[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm

For Reference : nvm docs

you can verify the installation of nvm using the command

1command -v nvm

Now, you can install or update the nodejs using nvm easily

1nvm install 10
1nvm use 12

Using Node Package Manager(npm)

you can install nodejs using a npm package called n. Once it is installed, make sure to clear the cache using the command

1sudo npm cache clean -f

After that install the n npm module in your machine

1npm install -g n

Now, you can install the nodejs using the command

1n 10.16.0
2n lts


Once you complete the installation of nodejs and npm . you can verify the installation using the command,

1npm --version
2node --version

it will show you the installed versions of nodejs and npm. How to install nodejs in macos.

To Read More

I Accidentally wiped the entire dat...

One of the tragic accident in my job turned out to be good learning for me in re...

List of Docker Container Commands y...

This article covers list of commands that you should know to manage docker conta...

Everything you need to know about d...

Docker volume is a persistent data storage mechanism to store the data in docker...