Before starting: Make sure you have the necessary folders and permissions — get more information.

Links: Homepage | Downloads | Documentation
Dependencies: None
Version: 5.0.0

Redis is an open source, BSD licensed, advanced key-value store.

Get the Code

Switch to /usr/local/src and download the source package.

cd /usr/local/src
curl --remote-name

Extract the archive and move into the folder.

tar -xzvf redis-VERSION.tar.gz
cd redis-VERSION

Compile and Install

Configure, compile and install into /usr/local/mac-dev-env/redis-VERSION.

make PREFIX=/usr/local/mac-dev-env/redis-VERSION install

Create a symbolic link to /usr/local/redis.

sudo ln -s mac-dev-env/redis-VERSION /usr/local/redis


Execute the following lines to update your Bash startup script.

echo 'export PATH=/usr/local/redis/bin:$PATH' >> ~/.bash_profile

Load the new shell configurations.

source ~/.bash_profile


Create a folder that will contain your database. My database is located in /usr/local/var/redis. You can place your database wherever you'd like but make sure you update the path when mentioned throughout this article.

mkdir -p /usr/local/var/redis

Configuration File

Create a configuration file so you can make changes to your configuration without messing around with command line arguments.

nano /usr/local/redis/redis.conf

Copy and paste the following text into the aforementioned file.

# Data folder
dir /usr/local/var/redis
# Bind to localhost

Manual Start/Stop

To start the Redis server.

redis-server /usr/local/redis/redis.conf

Press CTRL-C to stop the Redis server.

Automatically Start the Server at Boot

Create a configuration file for Launchd.

nano ~/Library/LaunchAgents/io.redis.redis-server.plist

Copy and paste the following text into the aforementioned file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">




Register with Launchd and start the server.

launchctl load ~/Library/LaunchAgents/io.redis.redis-server.plist

Deregister with Launchd. Kill the process manually.

launchctl unload ~/Library/LaunchAgents/io.redis.redis-server.plist

Verify the Installation

Verify that you have successfully installed Redis.

redis-server -v

Testing Redis

You can connect to the Redis server using the command line utility.


To test if everything is working correctly.


To set a cache item.

set foo hello

To retrieve the cache item.

get foo

To exit the session.


For more information on using Redis commands.