Homebrew执行brew install出现错误(homebrew-bottles)
问题描述
在使用homebrew安装软件时,出现如下报错:
Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles-portable-ruby/portable ruby-3.4.5.arm64_big_sur.bottle.tar.gz
curl: (22) The requested URL returned error: 404
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:20fa657858e44a4b39171d6e4111f8a9716eb62a78ebbd1491d94f90bb7b830a
curl: (6) Could not resolve host: pkg-containers.githubusercontent.com
Deepseek说是下载源出了问题,于是在网上找了换源的教程,结果还是不行,后来发现,这篇教程修改的配置文件是.zshrc
,后面找了另一篇教程,修改的配置文件是.zprofile
,遂成功。如下:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"' >> ~/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"' >> ~/.zprofile
echo 'export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"' >> ~/.zprofile
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"' >> ~/.zprofile
将上面这段粘贴到终端,回车。使用vim打开./zprofile
,找到类似下图中的配置并注释掉。保存并退出,然后执行source ~/.zprofile
。
此时再执行brew install
或者brew update
这些命令,就不会再报错啦。