安裝
終端輸入:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
卸載將install改為uninstall即可
更換源
# 替換brew.git:
$ cd "$(brew --repo)"
# 中國科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清華大學(xué):
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替換homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中國科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清華大學(xué):
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替換homebrew-bottles:
# 中國科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 清華大學(xué):
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 應(yīng)用生效:
$ brew update
如果折騰多導(dǎo)致homebrew有問題:
# 診斷Homebrew的問題:
$ brew doctor
# 重置brew.git設(shè)置:
$ cd "$(brew --repo)"
$ git fetch
$ git reset --hard origin/master
# homebrew-core.git同理:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git fetch
$ git reset --hard origin/master
# 應(yīng)用生效:
$ brew update
完成更新源的更換后,我們可以使用
$ brew upgrade
將現(xiàn)有的軟件進行更新至最新版本肺稀,這樣便能很直接的看出速度上的變化了鳍侣。最后$ brew cleanup
將舊有的軟件安裝包進行清理
錯誤解決
(1)安裝很慢出現(xiàn)git錯誤丁稀,修改配置
安裝如果很慢出現(xiàn)如下錯誤
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: The remote end hung up unexpectedly 3
fatal: early EOF 4
fatal: index-pack failed
可以使用命令修復(fù)
git config --global http.postBuffer 524288000
部分參考:[Edviin_2de8]