Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
@jsl jsl
65 lines (42 sloc) 3.233 kb

Installing Node

In this chapter we will be looking at the installation and compilation of node. Although there are several ways we may install node, we will be looking at homebrew, nDistro, and the most flexible method, of course - compiling from source.


Homebrew is a package management system for OSX written in Ruby, is extremely well adopted, and easy to use. To install node via the brew executable simply run:

$ brew install node.js


nDistro is a distribution toolkit for node, which allows creation and installation of node distros within seconds. An nDistro is simply a dotfile named .ndistro which defines module and node binary version dependencies. In the example below we specify the node binary version 0.1.102, as well as several 3rd party modules.

node 0.1.102
module senchalabs connect
module visionmedia express 1.0.0beta2
module visionmedia connect-form
module visionmedia connect-redis
module visionmedia jade
module visionmedia ejs

Any machine that can run a shell script can install distributions, and keeps dependencies defined to a single directory structure, making it easy to maintain an deploy. nDistro uses pre-compiled node binaries making them extremely fast to install, and module tarballs which are fetched from GitHub via wget or curl (auto detected).

To get started we first need to install nDistro itself, below we cd to our bin directory of choice, curl the shell script, and pipe the response to sh which will install nDistro to the current directory:

$ cd /usr/local/bin && curl | sh

Next we can place the contents of our example in ./.ndistro, and execute ndistro with no arguments, prompting the program to load the config, and start installing:

$ ndistro

Installation of the example took less than 17 seconds on my machine, and outputs the following stdout indicating success. Not bad for an entire stack!

... installing node-0.1.102-i386
... installing connect
... installing express 1.0.0beta2
... installing bin/express
... installing connect-form
... installing connect-redis
... installing jade
... installing bin/jade
... installing ejs
... installation complete

Building From Source

To build and install node from source, we first need to obtain the code. The first method of doing so is via git, if you have git installed you can execute:

$ git clone && cd node

For those without git, or who prefer not to use it, we can also download the source via curl, wget, or similar:

$ curl -# > node.tar.gz
$ tar -zxf node.tar.gz

Now that we have the source on our machine, we can run ./configure which discovers which libraries are available for node to utilize such as OpenSSL for transport security support, C and C++ compilers, etc. make which builds node, and finally make install which will install node.

$ ./configure && make && make install
Jump to Line
Something went wrong with that request. Please try again.