替换Homebrew源

在用brew时偶尔会出现卡死或者卡在updateing brew的情况,这个情况多数是因为外网不通的问题。替换homebrew源即可。

替换brew.git:

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/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

这是中科大的镜像,需要替换清华的请移步清华大学镜像官网:https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

恢复官方源请使用:

cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git