解决Homebrew下载更新极慢的问题

https://www.jianshu.com/p/055832c19148

 

由于问题主要是在国内网络环境github下载慢,因此尝试:

更换使用国内的homebrew镜像源;

使用代理访问github.com

更换Homebrew源

使用以下命令更换国内阿里云上的homebrew镜像:

# 替换brew.git:

cd "$(brew --repo)"

git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

# 替换homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

# 替换homebrew-bottles:

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

source ~/.zshrc

替换后,问题依旧,继续查看日志:

 

可以看到由于homebrew-cask的仓库依然指向了Github,这个过程还是慢。阿里云的镜像站没有提供homebrew-cask,进一步搜索找到USTC镜像站,该站提供了homebrew-cask的源。使用上述同样的命令更换源:

# 替换homebrew-cask.git:

cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

 

测试发现问题解决。

posted @ 2020-01-05 16:33  ctgu_czy  阅读(873)  评论(0编辑  收藏  举报