Create Redis database on Mac

There are two ways to install Redis on Mac:

Homebrew is the easiest and most flexible way to install Redis on MacOS. It is a package management software for MacOS. It automates Redis installation process, making it quick and easy to add Redis to your system.

Follow the below steps to install Redis on Mac using Homebrew:

Step 1: Install Homebrew#

/bin/bash -c "$(curl -fsSL"

Step 2: Install Redis using Homebrew#

brew update
brew install redis

Step 3: Launch Redis service#

To have launchd start redis now and restart at login:

brew services start redis

Step 4: Test if Redis server is running.#

redis-cli ping

It should return PONG. This command is often used to test if a connection is still alive.

Step 5: Launch Redis on system boot#

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

Step 6: Run Redis service using a configuration file#

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

Step 7: Interacting with Redis Client#

redis> set foo bar
redis> get foo

Please note: By default, Redis has 0-15 indexes for databases, you can change that number databases NUMBER in redis.conf.

Step 8: Stop the Redis service#

brew services stop redis

Step 9: Uninstall Redis#

brew uninstall redis

Next Step#