Installing Redis on Mac OSX
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:
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:
Then go into the newly created directory and build the source:
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:
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:
You will see some output similar to:
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:
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:
Congratulations, you are now ready to start using Redis. Have fun!