首先,了解下homebrew是什么?
请看官网https://brew.sh/index_zh-cn.html
安装homebrew:
直接打开mac的终端,在终端中粘贴执行以下命令
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
按照命令行提示进行安装,出现以下错误:
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
出现这个错误的原因是项目太久,tag资源文件太大
解决方式:
命令终端输入
git config --global http.postBuffer 524288000
然后在重新执行brew安装命令即可
出现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了。