In this article, we will be installing Redis data store on Windows and Mac OS. While installing Redis on Windows, we will be using Bash on Ubuntu on Windows application to set up the Redis locally. In the mac system, we will be using Homebrew as well as .tar file to install it. Once, the installation and setup is done, we will be using command lines to perform some get and put request to the Redis cache.
Homebrew is a package manager for Mac OS similar to apt-get in Linux for installing any software. If you don't have it installed on your Mac then you can follow this guide to install Homebrew. Once, installed you can execute below command on the termonal.
brew install redis
All the installation information can be found at
There are two ways to start Redis server. Either you can start Redis as a service so that it will keep running in the background with the following command:
brew services start redis
Or, if you don't want a background service you can just run below command
Once, the Redis is started in the background, you can use
brew services stop redis to stop the service. To uninstall the server, you can execute below command.
brew uninstall redis
And, to check if the Redis servicce is running, you can run
Homebrew is the best way to install any packages on mac but you can also download the zip file and manually install it. Below are the commands to install it manually.
Redis is implemented in C language and hence the .tar file has files with extension .c. After execution of the
make command, files with extension .o will be generated.
To start the Redis, you can run the command
The Redis project does not officially support Windows. Hence, Bash on Ubuntu on Windows application is installed. You can follow this official documentation for Linux Installation Guide for Windows 10.
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Once, done you can run below commands to install Redis.
sudo apt-get update sudo apt-get upgrade sudo apt-get install redis-server sudo service redis-server restart
Once, the Redis server is installed and running(default port 6379), we can use below command to test if Redis is running. The output will be
sudo service redis-server stop sudo service redis-server start sudo service redis-server restart
Start Redis cli with the command
redis-cli first before trying out below commands:
redis-cli -h 126.96.36.199 -p 16379 -a "password" //connect to remote redis server at 188.8.131.52 at 16379 SET name dhiraj //adds a key value pair in Redis cache. Here the key is name and the value is dhiraj GET name //Pulls value of supplied key EXISTS name //Checks if supplied key value pair exists. Outputs 1 if true DEL name //Deletes the entry of given key if present