微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

解决 MAC 上 brew update 更新缓慢甚至卡死状态

 

MAC 下 Homebrew 认的源是:

https://github.com/Homebrew/brew

 

执行以下命令 ,查看更新的详细过程:

$ brew update -verbose
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew...
Fetching /usr/local/Homebrew...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew/Library/Taps/mongodb/homebrew-brew...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...

 执行过程会一直卡在 homebrew-services 处缓慢执行。

 

使用 brew doctor 查看源是哪里:

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you an update run:
sudo rm -rf /Library/Developer/CommandLinetools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.

 

此处可以说明 homebrew 使用了认的源,否则会提示使用以下命令替换源:

$ git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew
$ git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://github.com/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

//替换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” 命令执行更新即可!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐