解決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

 

測試發現問題解決。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM