Install Redis and set multiple Redis instances on Mac OS

Install Redis with brew, if you don’t have brew installed yet, google how to install brew on Mac.

brew install redis

To have redis started on login.

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Start redis with launchctl.

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Start redis with redis-server command.

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

To enter redis interactive console.


To list all keys in redis.

keys *

To clear all redis keys.


To exit redis interactive console.


To set a new instance of redis, all you need is a new redis config file, start redis with that config file and you will have a second redis instance up and running.

1. Copy the default redis config file that is used for the default redis instance.

cp /usr/local/etc/redis.conf /usr/local/etc/redis2.conf

2. Open the redis2.conf and change the configuration for deamonize, pidfile, port, unixsocket, logfile and dbfilename to the below

daemonize yes
pidfile /usr/local/var/run/
port 6380
unixsocket /tmp/redis-2.sock
logfile "/usr/local/var/log/redis-2.log"
dbfilename dump-2.rdb

3. Create launch on login config file.

cp ~/Library/LaunchAgents/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist

4. Open ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist and change the configuration as need so it will look like the below

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

5. Load redis with the plist file

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis2.plist

6. Start redis with the config file.

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

7. To have redis launch on start

ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

8. To enter the second redis instance interactive console.

redis-cli -p 6380

Search within Codexpedia

Custom Search

Search the entire web

Custom Search