在执行brew 命令的时候默认会自动从 https://formulae.brew.sh/api/formula.jws.json 下载最新的JOSN 文件。速度非常慢,几分钟下载不下来。

brew install telnet 
==> Downloading https://formulae.brew.sh/api/formula.jws.json
Warning: formula.jws.json: update failed, falling back to cached version.
==> Downloading https://formulae.brew.sh/api/formula.jws.json

解决方法就是设置国内的加速代理,  在系统环境变量里面增加配置HOMEBREW_API_DOMAIN,  设置方法如下:

在终端输入 vim ~/.zshrc 编辑配置文件

sudo vim ~/.zshrc

在文件未加入以下配置

export HOMEBREW_API_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/api

退出并保存

执行 source ~/.zshrc 使配置生效

再执行 brew update 更新

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐