Install nvm – Node Version Manager & node on Mac

Quick tip of the day. How to install nvm (Node Version Manager) & Node?

osMac:
I am going to use Homebrew to install NVM on Mac, follow the steps given below.

  1. brew update
  2. brew install nvm
  3. mkdir ~/.nvm
  4. nano ~/.bash_profile

Once you have run above commands successfully, next you need to modify your .bash_profile or .zshrc (robbyrussell/oh-my-zsh) depends what you are using. Add following two lines at the end the .bash_profile file.

  1. export NVM_DIR=~/.nvm
  2. source $(brew --prefix nvm)/nvm.sh

Save and exit the file to check if nvm is installed and configured correctly.

  1. source .bash_profile
  2. echo $NVM_DIR , if you see the correct nvm path, then all set.

Let’s install node, but before you install node take a look at available node versions in order to get idea how they are named.

  1. nvm ls-remote, go for your desire version or you can alway look for “(Latest LTS: Dubnium)”
  2. nvm install v10.13.0

After this you have successfully install nvm, node & npm, run following commands to verify installed versions.

  1. node -v
  2. npm -v

That’s it, see you in next quick tip.

 

About the author

Danyal Ali Butt

I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.

View all posts