What is the best way to install Node js on OS X?

I find the best way to install Node.js is to use nvm, which allows you to install and manage multiple versions of Node.

I use Homebrew for pretty much everything else, but Node is easier to use through nvm, since it doesn't use global folders - everything is in your home directory, and you can easily switch between Node versions.

To install (check the website for the latest version):

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

There are some specific notes about OS X on the web site, please make sure to read through those, e.g. regarding the use of the ~/.bash_profile file.

After that, the nvm function will allow you to specify which version of node to install and use. In the simplest case, you run

nvm install node

which will install the stable version of Node.js.