Chris Mendez

How to install NVM (Node Version Manager) with Homebrew

If you create Angular apps, it's inevitable that you'll need to manage different versions of node. Node Version Manager makes it really easy to do so here's how to install NVM on Mac using Homebrew.

If you don't have Homebrew installed yet, read this article.

Step 1: Install NVM

Install node version manager.

brew install nvm

brew-install-nvm

Step 2: Create a directory for NVM

mkdir ~/.nvm/

Step 3: Configure your environmental variables

Either create or open your .bash_profile.

vim ~/.bash_profile

Paste this.

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

Execute the content we just pasted.

source ~/.bash_profile

Step 4: Double check your work

If you've done everything correctly, you should be able to run the nvm command and ask it to list which versions node are available.

nvm ls

nvm-ls

Step 5: Install Node

You can see a list of previously released versions of node from the NodeJS release page

Install Node 6.x.x.

nvm install 6.11.4

nvm-install-6.11.4

Install Node 8.x.x

nvm install 8.0.0

Double check your installation.

nvm ls

nvm-ls-again