当前位置:网站首页>Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
Homebrew brew update 长时间没反应(或卡在 Updating Homebrew...)
2022-07-29 06:33:00 【清木Moyu】
一、问题简介
Mac Homebrew 安装与卸载
有时候在 brew update、brew install xxx … 命令的时候会长时间没反应或者卡在 Updating Homebrew...。
原因是:由于我们安装的 brew 默认 repo 是官方的 repo,出于国内特殊原因无法连接,所以使用 Alibaba 的 Homebrew 镜像源进行加速后问题就能解决。
平时我们执行 brew 命令安装软件的时候,跟下面 3 个仓库地址有关:
brew.git
homebrew-core.git
homebrew-bottles二、解决办法(按步骤依次替换下去,后续可还原)
替换 brew.git 仓库地址
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git还原:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git替换 homebrew-core.git 仓库地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git还原:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git替换 homebrew-bottles 访问地址:
1、这个步骤跟 macOS 系统使用的 shell 版本有关系,先查看 shell 版本
echo $SHELL会输出
/bin/zsh
或
/bin/bash2、如果输出 /bin/zsh,访问地址换成这个:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc还原:
vi ~/.zshrc
# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
source ~/.zshrc3、如果输出 /bin/bash,访问地址换成这个:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile还原:
vi ~/.bash_profile
# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
source ~/.bash_profile配置到这里就结束了,可以再次执行
brew update 如果正常运行,可以不用往下看了!!
如果不行,就继续看:
brew doctor# 输出如下的错误信息
/usr/local/Homebrew/Library/Homebrew/global.rb:12:in `require': cannot load such file -- active_support/core_ext/object/blank (LoadError)
from /usr/local/Homebrew/Library/Homebrew/global.rb:12:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'无论报什么错误,先不管,执行以下命令
brew update-reset等待更新完成之后,再次执行
brew update 如果正常运行,可以不用往下看了!!
如果报错 homebrew-core is a shallow clone.
Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!删除 homebrew-core 后更新即可
cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
brew upgrade 使用 $ brew upgrade 后会重新更新 homebrew-core
如果 $ brew upgrade 安装速度太慢,直接 control + c 停下来,按下面的方式进行安装
// 进入 Taps 文件夹
cd /usr/local/Homebrew/Library/Taps // 新建 homebrew 文件并进入,如果有这个文件可以直接进入
mkdir homebrew && cd homebrew
# 或
cd homebrew// Git 下载
git clone git://mirrors.ustc.edu.cn/homebrew-core.git成功之后,执行安装命令,中途需要回车确认:
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"最后看到 ==> Installation successful! 就说明安装成功了。
最后可以在更新一下,一般现在已经是最新版本了,然后就可以通过 brew 进行安装工具了。
brew update
边栏推荐
- 解决CSDN因版权不明而无法发布博客的问题
- OCR光学字符识别方法汇总
- Excerpts from good essays
- Thread - thread safety - thread optimization
- Record - step on the pit - real-time data warehouse development - doris/pg/flink
- Analog volume leetcode [normal] 093. Restore IP address
- 使用VsCode配置MySQL实现连接、查询、等功能
- ECCV 2022 lightweight model frame Parc net press apple mobilevit code and paper Download
- 基于C语言设计的学籍管理系统
- vim文本编辑器的一些使用小技巧
猜你喜欢

Is online legend software testing training really so black hearted? Are they all scams?

城市花样精~侬好!DESIGN#可视化电台即将开播

MySQL advanced (Advanced) SQL statement (I)

Kubernetes (五) ---------部署 Kubernetes Dashboard

2D cartoon rendering - advanced skills

Flink real time warehouse DWD layer (traffic domain) template code

我的创业邻居们

Redis基础篇

微信小程序的反编译

Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
随机推荐
实现改变一段文字的部分颜色效果
我的创业邻居们
Excerpts from good essays
[C language brush leetcode] 2332. The latest time to get on the bus (m)
CVPR2021| 基于自监督学习的多视图立体匹配 (CVPR2021)
约瑟夫环问题
Improved pillar with fine grained feature for 3D object detection paper notes
Basic knowledge of MySQL (high frequency interview questions)
CAN&CANFD综合测试分析软件LKMaster与PCAN-Explorer 6分析软件的优势对比
Dbasql interview questions
Thread synchronization - producers and consumers, tortoise and rabbit race, dual thread printing
Teacher Wu Enda's machine learning course notes 02 univariate linear regression
SSH免密登录-两台虚拟机建立免密通道 双向信任
vagrant box 集群 处理
Problems encountered in vmware16 installing virtual machines
基于C语言实现图书借阅管理系统
数组的子集能否累加出K
Teacher Wu Enda machine learning course notes 05 octave tutorial
pytorch的技巧记录
Junda technology | applicable to "riyueyuan" brand ups wechat cloud monitoring card