July 24, 2013

212 words 1 min read

Setting up Node.JS on OSX – Quick and Easy

Recently, I’ve gotten into learning Node.JS. Installing Node on my servers for remote development is easy enough with a wajig install nodejs, however I want to be able to work off my laptop while I’m on vacation. While it’s not quite as easy as one command, it really isn’t that hard to setup.

You can simply download and install the

NodeJS package, but getting NodeJS up and running “nicely” requires you use something like Homebrew or MacPorts. My preference is Homebrew, so the instructions reflect that:

  • Download & Install Command Line Tools for Xcode
  • Install Homebrew by running the following in a terminal window:
  • ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
  • Run brew doctor as instructed and fix any issues you might have.
  • Update your PATH variable
  • (in a terminal) nano ~/.profile
  • Add a single line that reads: export PATH=$PATH:/usr/local/sbin:/usr/local/share/npm/bin/
  • Restart terminal window
  • brew install nodejs
  • brew install npm
  • Done! At this point you’ll have a functional Node.JS and npm environment (Yes, technically you don’t need npm — but that is like running Debian/Ubuntu without apt-get… why would you?). While you’re at it, you might consider adding Bower ( npm install bower ) for your frontends needs. Now go forth and Javascript! (Really never thought I’d ever say that again after the mid 90s)