You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

执行brew upgrade时出现curl: (22) 404错误求助

解决brew upgrade时curl 404错误的方法

执行brew upgrade时出现以下404错误,但brew list等其他命令正常:

==> Downloading https://formulae.brew.sh/api/cask.jws.json
curl: (22) The requested URL returned error: 404

Error: Failure while executing; /usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.0.13\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 12.6.2\)\ curl/7.79.1 --header Accept-Language:\ en --fail --progress-bar --location --remote-time --output /Users/username/Library/Caches/Homebrew/api/cask.jws.json --compressed --speed-limit 100 --speed-time 5 --progress-bar https://formulae.brew.sh/api/cask.jws.json exited with 22. Here's the output:
curl: (22) The requested URL returned error: 404

可以尝试以下步骤解决:

  • 清理Homebrew缓存
    缓存的旧API文件可能导致错误,执行命令清理:

    brew cleanup -s
    rm -rf ~/Library/Caches/Homebrew/api
    
  • 更新Homebrew核心
    先更新brew本身,确保使用最新的API路径:

    brew update
    

    如果brew update失败,强制重置brew的git仓库:

    cd "$(brew --repo)"
    git fetch --prune
    git reset --hard origin/master
    brew update-reset
    
  • 检查网络连接
    测试能否正常访问目标API地址:

    curl -I https://formulae.brew.sh/api/cask.jws.json
    

    如果仍返回404,尝试切换网络(如手机热点),或检查本地代理、防火墙是否拦截了请求。

  • 手动修复API路径(极端情况)
    若上述方法无效,可能是旧版本brew使用了废弃的API路径。编辑brew的API配置文件(路径通常为/usr/local/Homebrew/Library/Homebrew/api.rb),将涉及cask.jws.json的地址替换为最新路径,或直接升级到最新版brew。

内容的提问来源于stack exchange,提问作者willwrighteng

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 17:07:07