在Mac中使用brew install命令安裝軟件時出現 Updating Homebrew... 卡住的問題,原因是本機與鏡像源的網絡不通,或網速很慢。
我們要做的是,只需要確保已安裝homebrew,更新鏡像源就可以了。
我們執行 brew 命令安裝軟件的時候,跟以下 3 個倉庫地址有關:brew.git、homebrew-core.git 和 homebrew-bottles。
通過以下操作替換這三個倉庫地址即可。
1. 替換brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/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
3. 重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
4. 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git