当前位置:首页 > 操作系统 > MacOs

Mac brew换源

<code># 换源
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
</code>

 

<code>
# 还原
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一下即可
 </code>

 


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐