Installing node.js, npm, and redis on Mac OS X

I’ve been wanting to mess with I/O Docs for some time now. I/O Docs requires node.js, npm, and redis. I hear the buzz around these technologies, but I have yet to use them. Although I found several posts and a package for installing node.js and npm on Mac OS X, each had issues. Mac OS X runs atop BSD Unix. So, while potentially intimidating, you can install all these yourself by running commands within Terminal.

Installing node.js

After much Googling I discovered an overwhelming set of node.js installation instructions. In a nutshell (no pun), this installs node.js under a newly created local folder in the current user folder and adds that folder to your PATH so you can run node.js simply by typing node.

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bash_profile
source ~/.bash_profile
mkdir ~/local
mkdir ~/node-js
cd ~/node-js
curl http://nodejs.org/dist/node-v0.4.7.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install

A few notes.

First, this installs node.js version 0.4.7. From what I read, this is currently the most compatible version. If you require a different version, I’ll assume you know more about installing node.js than me.

Second, bash on Max OS X uses .bash_profile not .bashrc. I’ve modified the original script to reflect these changes.

Installing npm

Once you have installed node.js, you can install npm with just one command.

curl http://npmjs.org/install.sh | sh

I should pass along the warning that this runs commands streamed from the internet. If you’re paranoid about that kind of stuff, you should download and verify install.sh first.

Installing redis

Redis was a straightforward install. For the most part I followed the redis quickstart guide. I modified the script below slightly to use curl as Mac OS X does not include wget.

curl -O http://redis.googlecode.com/files/redis-2.4.4.tar.gz
tar -xzf redis-2.4.4.tar.gz
cd redis-2.4.4
make
rm redis-2.4.4.tar.gz

In closing

In time, you may need to update the versions for node.js and redis. Both offer a latest download. Feel free to substitute these into your script. The commands above should still work. Nonetheless, I tried to provide links to the original documentation when available.

Check out my recent post if you are interested in getting started with I/O Docs.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>