美文网首页
Homebrew 使用国内镜像源

Homebrew 使用国内镜像源

作者: 温柔的码农 | 来源:发表于2019-12-23 14:25 被阅读0次

切换到阿里镜像源

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

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

# 阿里的没有 cask 镜像源, sigh~~

brew update

加入 .bashrc 或 .zshrc

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

切换到中科大镜像源

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

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

brew update

加入 .bashrc 或 .zshrc

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles

切换到清华镜像源

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

brew update

加入 .bashrc 或 .zshrc

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

重置为默认源

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

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

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

brew update

从 .bashrc 或 .zshrc 移除以下行

export HOMEBREW_BOTTLE_DOMAIN=xxxxxxx

再执行

source ~/.bashrc
# 或 
source ~/.zshrc

参考:

https://brew.sh
https://developer.aliyun.com/mirror/homebrew
https://lug.ustc.edu.cn/wiki/mirrors/help/brew.git
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

相关文章

网友评论

      本文标题:Homebrew 使用国内镜像源

      本文链接:https://www.haomeiwen.com/subject/fvvznctx.html