I decided to go down the route of installing Homebrew as it seems it’ll come in handy at a later date for installing other bits and pieces.
To install Homebrew you’ll need to make sure you have the Apple developer tools installed, namely Xcode along with the command line tools.
Installing Xcode is easy, simply go to the App Store and search for Xcode. Then to check whether you have the command line tools installed on not enter the following using the Terminal –
If they are installed, the above command should return a path, in my case –
However, if you don’t get a valid path returned you can install the tools using –
This will pop up a dialogue asking permission to install, then go away and do it. More details on installing Xcode and the command line tools is available here.
Once the Xcode command line tools are installed, installing Homebrew is easy – instructions to install Homebrew, which is also known simply as brew are available on the website brew.sh but its simply installed in the Terminal with –
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
This goes away and downloads the latest version and installs it for you. Once its finished you can make sure everything is fine and dandy by using –
That’s brew installed to get Node.js using brew is dead simple – although the first job before installing something is to run an update of brew and its list of available packages –
Once that’s done, you can actually install Node.js, simply using –
brew install node
Like the package managers in Linux if the package you’re installing requires anything else to be installed, brew also goes and gets that.
Once Node.js is installed, you can check which version you have with –
This should respond with the current version, v0.10.28 at the time of writing this.