HTML and CSS Reference
Installing Node on OS X
On OS X, you need a build environment to install native modules as well. This means either installing XCode or
installing the command-line tools for XCode. If you aren't going to use the XCode IDE, you can get away with
just installing the free command-line tools, which are available at no charge from https://developer.apple.com/
You need to create a free developer ID account if you don't already have one to access the page. After you set
up your build environment (either XCode or the preceding download), install Homebrew if you don't already
have it installed. Homebrew provides an isolated environment for installing a large variety of packages. You can
download Homebrew by following the instructions at http://mxcl.github.com/homebrew .
After you install Homebrew, you can run the following command from Terminal:
brew install node
This code installs an up-to-date version of Node so you are up and running with npm, the node package man-
Installing Node on Linux
On Linux, life is generally simpler and you can use the pre-installed package manager to get up and running if
it's provided. On Ubuntu you should run the following:
sudo apt-get install node
If your package manager doesn't have an up-to-date version, you can download the source package from ht-
You may need to run the last command as root to install Node globally.
Tracking the Latest Version of Node
Node is a fast-moving project, and if you want to stay on the bleeding edge, you can download the latest version,
commonly referred to as HEAD, from the github repository at https://github.com/joyent/node.git .
As is usually the case with open-source software, you should be careful using the latest version of Node in
a production project. It's generally much safer to stick with a numbered release unless you desperately need a
feature or bug fix in the latest version and are working on a larger project that won't release for a while.
Installing and Using Node Modules
After you install Node, you can use any of the hundreds of modules that people have packaged and made avail-
able. To do this use npm, the node package manager, which provides an automated way to download and install
libraries and utilities. Previously, npm was installed separately from Node, but they are now packaged together.
If you don't have npm installed, make sure you run a newer version of Node.