macOS HomeBrew更换源 brew常用命令说明
homebrew本身就是一个git仓库。使用homebrew安装软件包时,会自动先下载软件包,然后解压安装,但有时候下载会卡住,或者很慢,这个时候有以下几种方法:
1.临时的终止update,先control+c,停掉当前update,安装继续
2.更改更好用的git远程仓库
替换homebrew默认源(源代码仓库)
cd "$(brew --repo)"
git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
image.png
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
image.png
替换homebrew-bottles(预编译二进制软件包)
bash用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
zsh用户:
echo 'export HOMEBREW_BOT