安装redis
brew install redis
安装成功后,有如下提示
zhoulindeMacBook-Pro:~ zhoulin$ brew install redis
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/redis-4.0.1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring redis-4.0.1.sierra.bottle.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
brew services start redis
Or, if you don't want/need a background service you can just run:
redis-server /usr/local/etc/redis.conf
==> Summary
/usr/local/Cellar/redis/4.0.1: 13 files, 2.8MB
zhoulindeMacBook-Pro:~ zhoulin$ brew services start redis
==> Successfully started `redis` (label: homebrew.mxcl.redis)
然后按照提示,启动redis
开机自启动
sudo cp /usr/local/opt/redis/homebrew.mxcl.redis.plist ~/Library/LaunchAgents/
sudo launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
sudo launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist #停止使用