In this post, I'll show you how to install Redis, a popular NoSQL database, on your OSX machine. For those unaware, Redis is described on its project site as:
an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
The great thing about Redis is that it uses an in-memory data set, making it incredibly fast at I/O. This can be handy in a lot of situations, but I'll go into more detail on its uses in another post.
To install Redis on your machine, we first have to get the latest source. This is easily done using wget:
$ wget http://redis.googlecode.com/files/redis-2.4.15.tar.gz<br />
I put this file in /usr/local/src, which is a directory I have created to hold source distributions. I'm getting version 2.4.15 here, because its the latest stable version at the time of writing. You should change the above wget command to get to most recent version.
Unpack the tarball you downloaded:
$ tar xzf redis-2.4.15.tar.gz<br />
Then go into the newly created directory and build the source:
$ cd redis-2.4.15<br /> $ make<br />
You shouldn't need sudo for this, if you put the code in a directory you have permissions on. But, if you get an error, try sudo.
Now install the binaries:
$ make install<br />
This will put the redis executables in /usr/local/bin, which is also in the system path, so you can launch redis from a terminal without an absolute path. Now redis is installed, and we can briefly test it out. Issue the following command to start the redis server:
$ redis-server<br />
You will see some output similar to:
 07 Jul 21:34:25 # Warning: no config file specified, using the default config. In<br /> order to specify a config file use 'redis-server /path/to/redis.conf'<br />  07 Jul 21:34:25 * Server started, Redis version 2.4.15<br />  07 Jul 21:34:25 * The server is now ready to accept connections on port 6379<br />  07 Jul 21:34:25 - 0 clients connected (0 slaves), 922304 bytes in use<br />
Good, the server is running. You see in the above messages that redis is operating in a default configuration. This is usually find for development, but for production needs, you will want to specify a config file. You can do this by including the path to the config file as an input parameter, such as:
$ redis-server /path/to/redis.conf<br />
The suggested standard placement of the config file is in a directory called ~/.redis. To create this and put a copy of the default redis config file there, you can use:
$ mkdir ~/.redis<br /> $ cp /usr/local/src/redis-2.4.15/redis.conf<br />
Congratulations, you are now ready to start using Redis. Have fun!