问题
想安装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
,成功。