This article explains the setup and configuration of the Redis server in macOS.
- How to install the Redis server
- Uninstall the Redis server
- Upgrade the Redis server
- Start, Stop and Restart the Redis server
homebrew is a package manager for managing the packages in MACOS. It automates the process for easy setup and configuration on MacOS. It provides a brew command to start, stop, installation of Redis server.
You can also install Redis without the brew command.
Install Redis Server in macOS
First, check whether the brew is installed or not using the below command.
brew --version
It gives the version number if the brew is installed.
Next, run the following command to start the installation process.
brew install redis
It installs the Redis on the Mac System with the default port and configuration.
You can always check Redis service status whether it is running or not.
brew services info redis
You can also connect to Redis using the redis-cli command as given below.
redis-cli
It connects to the Redis server and starts the interactive shell command prompt. It gives current running server information.
Redis server installation folder location:
You can always check the location of the redis installation using the redis-cli command
.
127.0.0.1:6379> config get dir
1) "dir"
2) "/usr/local/var/db/redis"
You can also use the which redis-server
command to get the installation folder.
Upgrade Redis to the latest version
- Open terminal
- First, Run the
brew update
command - Next, Type the` brew upgrade Redis command
It automatically updates Redis and it dependencies.
How to Restart, stop Redis server in macOS
- Restart the redis server
brew services restart redis
- start the redis server
brew services start redis
or use
redis-server & // run in background process
- To stop the redis server
brew services stop redis
Uninstall Redis Server in macOS
Use below command to install redis server in MacOS.
brew uninstall redis
How to run Redis Server as Daemon background in Mac
Redis runs as a separate process and does not run in background by default in MacOS
There are multiple ways we can do
- using
--daemonize
option
redis-server --daemonize yes
- using
nohup
nohup redis-server &
redis-server &