如果在MacOS上用brew安装管理软件包,发现速度慢,可以更换brew源,方法如下:

1. 替换brew.git

$ cd "$(brew --repo)"

# 中国科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

# 清华大学:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

复制

2. 替换homebrew-core.git

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

# 中国科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

# 清华大学:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

复制

3. 替换homebrew-bottles

# 中国科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

# 清华大学:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

复制

4. 应用生效

$ brew update
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐