MacBrew - huangyuefeng/study GitHub Wiki
为MAC更换Brew的数据源
在Linux上我们有yum工具,可以自动安装软件。 在MAC上,对应的有Brew工具,可惜该工具的美国安装源, 不仅速度慢,有时候还不稳定。
所以,快点更换到国内的安装源吧,享受飞一样的速度。 笔者下面示范怎么更换为中科大的安装源。
- 替换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
cd "$(brew --repo)"
git pull origin master
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
brew update
到此,切换完成,如果希望切换回去官方源,操作如下:
- 重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
- 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
- 注释掉bash配置文件里的有关Homebrew Bottles即可恢复官方源。 重启bash或让bash重读配置文件。
vi ~/.bash_profile
### edit ###
source ~/.bash_profile
- refer
https://blog.csdn.net/tzjvon/article/details/79648825
https://blog.csdn.net/weixin_40475396/article/details/78506641