按照官网指令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果提示出错了Error: /usr/local/Cellar is not writable. You should change the ownership and permissions of /usr/local/Cellar back to your user account:
按照提示输入下面指令
sudo chown -R $(whoami) /usr/local/Cellar
然后继续输入上面的安装指令,进行安装。
完成后,如果出现下面warning
Warning:/usr/local/bin is not in your PATH
此时使用brew命令,会提示:-bash: brew: command not found
解决方式如下:
sudo vim .bash_profile
添加 export PATH=/usr/local/bin:$PATH
source .bash_profile 使配置修改生效。
再次使用brew 命令就ok了。