1.下载安装脚本
https://raw.githubusercontent.com/Homebrew/install/master/install.sh
2.替换脚本安装源
BREW_REPO="https://github.com/Homebrew/brew"
替换
BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
3.使用脚本安装
HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git bash install.sh
4.替换中科大源
Homebrew Bottles 源
- bash 用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
- zsh 用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
Homebrew Core 源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
Homebrew Cask 源
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git