Installing Node on Mac OS X Lion works

Topics: 

I saw a blog post the other day where the person had a problem compiling Node for their Mac OS X Lion system. One of the C++ files failed to compile. I don't have the link to the post handy and did not check the exact error, but wanted to report on two successful ways to install Node for Lion.

The first method is to simply use MacPorts. I know there is this Brew system for simplifying open source software installation, but I've been using MacPorts for years and am accustomed to it as an old friend who you might not be fully comfortable about them, but they're a familiar face rather than the newcomer you don't know. That is, I haven't any idea whether one is better than the other, I use MacPorts because of familiarity.

The other day I decided to update my MacPorts to the latest ("sudo port selfupdate" followed by "sudo port upgrade outdated"). Along the way I was pleased to learn that MacPorts is supporting the latest Node.js AND the latest NPM.

This makes for an easy Node installation by doing: sudo port install nodejs npm

And because so many Node modules are being written with coffee-script nowadays (I don't understand the attraction, but what the hey). You can follow this up with: sudo port install coffee-script

This will get you the latest Node 0.4.x installed in a system-wide directory.

The other thing I checked is the install of Node 0.5.9, because Ryan Dahl put out a call for people to check this release because it's the candidate to become Node 0.6.

This version is not available via MacPorts (of course). So I did a "git clone" of the main Node repository, then did: ./configure --prefix=$HOME/0.5.9 ; make ; make install

Those three commands comprise the normal "local install in home directory" procedure. After this update your PATH like so: export PATH=$HOME/0.5.9/bin:$PATH

With this set up you can run Node applications from the command line. Because I was concerned about the examples in my book Node Web Development, I ran those applications. Fortunately they're mostly working, but I need to check more closely.

In any case the thing I want to report is that 0.5.9 works extremely well. Whether API changes in Node will break your application is a separate issue.