1、安装homebrew
终端执行命令(需要科学上网)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
或者使用方法二(不需要科学上网,100%成功)
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
执行完成之后,输入brew -v,能输出版本号即安装成功
2、开始安装redis
终端执行brew install redis
前台启动Redis,redis-server 。启动完后可以看到如下界面。停止服务control+c。
卸载指令
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
如果连接时出现报错:DENIED Redis is running in protected mode because protected mode is enabled,解决方法如下:
cd /usr/local/bin
./redis-cli config set protected-mode no