問題
想安裝tree的時候運行brew install tree,結果一直在跑Updating Homebrew… 似乎沒有反應。其實是鏡像的問題,更改到國內的鏡像就行了
解決
先更新brew。輸入brew update -verbose
,這樣能看到詳細過程,一般會發現卡在了
Fetching /usr/local/Homebrew…
或者
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core…
這兩個地方。
第一步,替換brew.git,輸入
cd "$(brew --repo)"
回車,輸入
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
第二步:替換homebrew-core.git,輸入
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
回車,輸入
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
一般來說這時再輸入brew update -verbose
是能更新完成的,但我在
Fetching /usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask…
的時候又卡住了。
再輸入cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
回車,輸入
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
最後運行brew update -verbose
,成功。