There are several ways to install Node.js on Yosemite:
- install the package from the Node.js site,
- install via
brew install node,
- and install via nvm, the Node Version Manager.
Naturally, I’ve decided to go with the least straightforward approach, which is installing via nvm. After spending too much time on the subject, it appears that Homebrew is a perfectly acceptable way to install Node, although that hasn’t always been the case. Manual installation is also a fine way to install it. However, I chose to nvm primarily for its versioning capabilities; that is, it works much like rvm/rbenv in that it can download and manage multiple versions of Node. Now, I’m not sure that I’ll ever need to keep track of multiple versions of Node, but it’s nice to have the option.
brew install wget
brew install git
git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
in order to have it available upon login, add the following to .bash_profile:
to see what’s currently installed:
to see what versions of Node are available for install:
once you’ve looked at which versions are available,
nvm install x.x.x (where x.x.x is the version number)
nvm install stable | unstable depending on your preference.
to set as default:
nvm use stable
just kidding, NPM is installed automatically with Node.
Installation and use of NVM: NVM
StackOverflow discussion on homebrew vs manual installation: Installing Node.js – pros/cons of using Brew vs manually managing?