Menu toggle

Node.js on OSX

Node.js is a fun new technology. If you are looking to experiment with it, here is a quick start guide on how to install it for people using OSX

Macports is so 1995

Install Homebrew, a much better alternative to macports

ruby -e "$(curl -fsSL"

Install Node.js and NPM

npm (Node Package Manager) is a nifty little tool to manage node packages

brew install node
brew install npm
export NODE_PATH="/usr/local/lib/node"

That'll do it's thing and voila!, you now have node installed. To quickly test if this is working create a file called test.js. In the file paste the following contents

const http = require('http');
    .createServer((req, res) => {
        res.writeHead(200, { 'Content-Type': 'text/plain' });
        res.end('Hello World\n');
    .listen(8124, '');

console.log('Server running at');

Now run and you should be able to hit to view the results

node test.js

A few more packages to play with while you experiment:

npm install expressjs

npm install jsdom

npm install yui3

npm install yql

Unstructured Scribbles is powered by Gatsby JS. Opinions on this website are my own and not of my employer.