NodeJS on OS X Lion
By AJ O'Neal, published 2011-11-30
Don’t kid yourself into thinking that you should use a NodeJS pkg. That’s good enough for opening the REPL, but very quickly you’ll find that you need to do real development and that means you need real developer tools.
Pull up your britches on and get your Terminal on!
-
Start your Terminal! (I recommend iTerm) and open the App Store
open -a "App Store" -
Install the XCode Installer from the App Store (you’ll be waiting a few hours)
-
Install XCode
⌘ [space] to bring up Spotlight Search for "XCode" Select "Install XCode" ⏎ Click Click, blah blah -
Install and update Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" cd /usr/local git checkout master ./ git pull origin master -
Install NodeJS
brew install nodejs brew update nodejs -
Test
node -e '0.1 + 0.2'
As long as you don’t end up with 0.3, you’ve probably got NodeJS installed correctly.
Code Well and Prosper
(function () {
"use strict";
// Always use strict mode.
// Friends don't let friends code crap!
// Don't ever use globals!
// ...but if you do, do it right!
var global = Function('return this')()
, msg = 'Hello World!'
;
console.log(msg);
}());