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一下即可
 

 

相关文章

方法: 打开一个新的可跨域的chrome窗口实现方法: 1. 打开终...
MacBook Pro 14价格和配置对比 尺寸 SOC	内存&#...
现在给大家介绍一下如何查询MAC的生产日期,希望对你查询MAC...
1、点击【编辑虚拟机设置】,转到【CD/DVD (SATA)】,选中【...
注意:用哪个版本的 Python 运行安装脚本,pip 就被关联到哪...
Mac 安装nvm