微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Mac 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.aliyun.com/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.aliyun.com/homebrew/homebrew-core.git  # 阿里源

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

4.homebrew-bottles
# bash 用户
echo 'export HOMEBREW_BottLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> ~/.bash_profile
export HOMEBREW_BottLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
source ~/.bash_profile
# zsh 用户
echo 'export HOMEBREW_BottLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> ~/.zshrc
source ~/.zshrc

5 最后执行 brew update

 


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

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

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

4. homebrew-bottle还原就去上面对应的文件内把export导入的语句删掉 重新source一下即可
 

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐