macOS

How to Install Redis on MacOS

In this tutorial, we will quickly learn how you can setup and configure Redis on macOS in very simple steps.
Captain Salem 1 min read
How to Install Redis on MacOS

Remote Dictionary Server, commonly known as REDIS is a free and open-source, in-memory data storage and caching system.

You will often hear developers referring to Redis as data structure server as it allows us to store, manipulate, and retrieve data structures from system memory.

Redis is designed to be a high-performance and low-latency data access system which makes it extremely suitable as a caching mechanism or environments where fast data retrieval is essential. An example would be real-time analytics, session management, queing systems, etc.

Prerequisites

Before we proceed with this tutoria, ensure that you have Homebrew installed on your macOS system. You can verify by running the command:

brew --version

If you have Homebrew installed, the command above should return the installed version as shown:

Homebrew 4.1.12

If the command above returns an error, you will need to install Homebrew before proceeding. You can check the tutorial below on how to set it up.

https://www.geekbits.io/how-to-install-and-use-homebrew-on-macos/

macOS Install Redis

Once you have Homebrew installed, open the terminal and run the command below to install Redis on your machine:

brew install redis

This will install Redis on your system.

Start and Stop the Redis sERVER

To test your Redis installation, you can run the redis-server command to run the Redis server in the foreground.

redis-server

To stop Redis, enter Ctrl-C.

Start and Stop Redis in the Background

To run Redis in the background, you can run the command:

brew services start redis

This will run the Redis serverin the background.

To view the information about the service, you can run the command as shown:

brew services info redis

Example output:

redis (homebrew.mxcl.redis)
Running: ✔
Loaded: ✔
User: csalem
PID: 8723

To stop the Redis server, run the command:

brew services stop redis

You can connect to the Redis server with the command:

redis-cli

Once logged in, you can run the Redis commands.

Conclusion

In this tutorial, we quickly covered you can download and install the Redis server on macOS using the Homebrew package manager.

Share
Comments
More from GeekBits

Join us at GeekBits

Join our members and get a currated list of awesome articles each month.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to GeekBits.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.