Homebrew安装

首先确认 xcode 已经安装

App Store 中安装。
或者

1
xcode-select --install 

打开 Homebrew 官网

https://brew.sh/index_zh-cn 按照官网提示或者直接复制下面内容进行安装。

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)

错误情况一:

1
2
3
4
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

解决方案:
设置请求的数据缓存大小,防止请求回执的数据庞大报错。

1
2
git config --global http.postBuffer 524288000

错误情况二:

1
fatal:unable to access 'http://github.com/Homebrew/brew/':Could not resolve host:github.com

删除 rm -f /usr/local/Homebrew 之后重试。重新执行安装