目录
一、镜像介绍
二、替换镜像
三、重置 Homebrew 镜像源
四、如果在brew update因为太慢而强制关闭出现问题
五、参考资料
一、镜像介绍
1、brew.git 镜像
中科大镜像:https://mirrors.ustc.edu.cn/brew.git
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
GitHub镜像:https://github.com/Homebrew/brew.git
2、homebrew-core.git 镜像
中科大镜像:https://mirrors.ustc.edu.cn/homebrew-core.git
清华镜像:https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
GitHub镜像:https://github.com/Homebrew/homebrew-core
二、替换镜像
1. 使用阿里云镜像
# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# 应用生效
brew update -v
# 替换homebrew-bottles(最好保存到配置文件):
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
2. 使用中科大镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
brew update -v
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
三、重置 Homebrew 镜像源
$ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core
四、如果在brew update因为太慢而强制关闭出现问题
Another active Homebrew update process is already in progress
解决办法 : rm -rf /usr/locai/var/homebrew/locks
五、参考资料
MAC OS系统替换homebrew使用阿里云或中科大的镜像源
Homebrew切换镜像源(中科大&清华镜像)