Mac brew detailed

brew install Redis
1️⃣, view Redis service
2️⃣, install the specified version of Redis
3️⃣, configure environment variables
4️⃣, start Redis (the following startup method, the service will not stop after the teminal window is closed)
5️⃣, view the list of locally running services
6️⃣, connect to the local Redis, simply operate and exit the connection to the
redis service. Set the boot method
1️⃣, start the redis command
2️⃣, use launchctl to start the redis server
3️⃣, use the configuration file to start the redis server
4️⃣, stop the self-starting of the redis server
5️⃣, the location of the redis configuration file
6️⃣, uninstall redis and its files
7️⃣, test whether the redis server starts
brew to install Redis

1️⃣, view Redis service

brew search redis

The ticked version on the picture is because I have installed this command before running


2️⃣, install the specified version of Redis

brew install [email protected]

3️⃣, configure environment variables

Open the .bash_profile file:

Open -e ~/.bash_profile after

adding the Redis environment variables as follows:

Configure the redis installation path to the Mac environment variable file

Make .bash_profile take effect:

source ~/.bash_profile
4️⃣, start Redis (the following startup method, the service will not stop after the teminal window is closed)

brew services start [email protected]            
5️⃣, view the list of services running locally

brew services list //View the list of running services

Check whether the Redis service is started successfully, brew search again, you can see that the installed version is ticked


6️⃣, connect to the local Redis, simply operate and exit the connection

Check whether the Redis service is started successfully, brew search again, you can see that the installed version is ticked

Redis service setting startup method

Note: When the above brew services start command fails to start the Redis service, you can use the following method
1️⃣, start the redis command on boot

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

2️⃣, use launchctl to start the redis server

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

3️⃣, use the configuration file to start the redis server

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

4️⃣, stop the self-starting of redis server

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

5️⃣, the location of the redis configuration file

/usr/local/etc/redis.conf

6️⃣, uninstall redis and its files

brew uninstall redis rm ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

7️⃣, test whether the redis server is started

redis-cli ping //You can also directly use redis-cli -h 127.0.0.1 to test whether you can connect to the Redis service