Install Node on OS X

Instructions that I used to install node recently.

Assumptions

You have homebrew already installed.

Install nvm

We’re going to install nvm, the node version manager (similar to rbenv). At the time this installed version 0.31. To see the latest instructions of setting up nvm, type in brew info nvm.

  1. Open Terminal
  2. Install nvm via homebrew: brew install nvm
  3. We want our node versions to be installed to a user local path, so make the folder ~/.nvm. Then append export NVM_DIR=~/.nvm to your bash profile: mkdir ~/.nvm echo "export NVM_DIR=~/.nvm" >> ~/.bash_profile
  4. Make sure nvm is available from the terminal: echo ". \$(brew --prefix nvm)/nvm.sh" >> ~/.bash_profile

Reload the bash profile source ~/.bash_profile or restart the terminal.

Install Node

Using nvm let us install the latest version. At the time, this was 5.8.0.

nvm install v5

Node that nvm will also make this the default node version which will be available from your PATH.

To see what the latest node version is type in (there may be v6, v7, etc.):

nvm ls-remote

Upgrade to latest npm

Finally, let’s make sure we have the latest npm:

npm install -g npm

And that should be it.