Homebrew更换阿里云镜像源或还原官方镜像站

还原官方镜像站

更换阿里云镜像站

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

执行 brew update 进行更新。

终端配置:
执行 echo $SHELL 查看终端版本

zsh 终端配置

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc

bash 终端配置

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
  • 终端配置完成后执行:source ~/.bash_profile 重新加载配置文件。

🛫️ 更换完成,尽情 brew install 吧!

 

 

还原官方镜像站

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

执行以上命令后
删除 ~/.zsh 或者 ~/.bash_profile 文件中的以下内容

 

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles

 

posted on 2022-09-04 21:37  漫思  阅读(390)  评论(0编辑  收藏  举报

导航