ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-08-31 21:02:49  阅读:393  来源: 互联网

标签:git update MAC usr Homebrew brew homebrew local


 

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

标签:git,update,MAC,usr,Homebrew,brew,homebrew,local
来源: https://www.cnblogs.com/diruizhixia/p/15212139.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有