Homebrew换源

更换中科大的源地址

更换Homebrew源文件仓库地址

1
2
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

更换Homebrew 核心软件仓库

1
2
3
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

更换Homebrew 预编译二进制软件包

对于 bash 用户:

1
2
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

对于 zsh 用户:

1
2
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

Homebrew cask 软件仓库,提供 macOS 应用和大型二进制文件

1
2
3
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

还原官方源地址

还原Homebrew源文件仓库地址

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

还原Homebrew 核心软件仓库

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

还原Homebrew 预编译二进制软件包

对于 bash 用户:

1
2
3
4
vim ~/.bash_profile
找到 “export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles'”代码行注释掉。
source ~/.bash_profile

对于 zsh 用户:

1
2
3
vim ~/.zshrc
找到 “export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles'”代码行注释掉。
source ~/.zshrc

还原Homebrew cask 软件仓库,提供 macOS 应用和大型二进制文件

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