Install nvm and node.js on OS X

Posted by {"display_name"=>"greg", "login"=>"greg", "email"=>"", "url"=>""} on November 25, 2014 · 1 min read

Here are the steps to install nvm and node.js on OS X. I'm using a MacBook Pro with Yosemite.

Install Script

Open an Terminal window and download the install script with the curl command.

curl | bash

nvm is shell script, which needs to be sourced in order to be available. To have it sourced in every terminal you open, put the following line in.bash_profile:

. ~/.nvm/

Close and re-open your terminal or source the script for the changes to take effect.

Install Node

You can find the latest version of node on the node.js download or you can install the latest stable release with the command:

nvm install stable

Install Node Packages

Let's install some node packages to make sure everything is working correctly:

npm install -g bower
npm install -g grunt-cli
npm install -g grunt
npm install -g yo
npm install -g rgstephens/generator-mobile

Displaying Global Packages

We installed the packages with the -g option so that they will be available to all node projects. To list the installed global packages you can use the following commands:

npm list -g
npm list -g --depth=0

Useful Posts

There were a couple of very useful posts on this topic. Jared Hanson has a 2011 post on this topic and there's an excellent response on Stackoverflow by Dominic Trancredi on how to perform a complete removal of node.