无用挂件の日记

HomeBrew安装の踩坑记录

Blog又咕咕咕了半个月,看着实在难受。于是记录一番安装HomeBrew的艰辛历程。
(显然不是给我自己装啦…手动滑稽)

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

此时滚到Downloading and Installing Homebrew...的时候就会出现curl 18报错。
报错内容如下:

error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly
fatal: early EOF

给出解决方案:

1、可能由于tag资源过大导致缓存区溢出。
那么就手动提高Buffer:

1
git config --global http.postBuffer 524288000

2、由于某墙的干扰导致单线程锁死

首先把安装脚本给拿下来:

1
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

再然后,vim打开brew_install,删除BREW_REPO那行,代之以如下内容:

1
2
BREW_REPO = “https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git“.freeze 
CORE_TAP_REPO = “https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git“.freeze

最后执行脚本:

1
/usr/bin/ruby brew_install

安装完毕后在Terminal中修改brew镜像源:

1
2
3
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update

Done,Enjoy!