使用中科大源
1、替换默认源
替换USTC镜像:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
重置为官方地址:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
替换 USTC 镜像:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
重置为官方地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core
brew update
请在运行 brew 前设置环境变量 HOMEBREW_BOTTLE_DOMAIN
,值为 https://mirrors.ustc.edu.cn/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
4、替换 Homebrew Cask 源
替换为 USTC 镜像:
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-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask
原文地址:https://www.cnblogs.com/dowhile/p/HomeBrew-shi-yong-guo-nei-shu-ju-yuan.html
时间: 2024-11-05 18:40:58