TinkOL

  • 首页
TinkOL
好记性不如烂笔头!
  1. 首页
  2. macOS
  3. 正文

修复homebrew安装软件404问题

2021年4月22日 10954点热度 21人点赞 9条评论

作为追新族,基本上我所有设备上的系统、软件,都会在第一时间更新到最新。因此我经常运行各种update命令,包括brew upgrade,但今天,发现和往常不太一样。

在更新软件时,终端中有不少黄字提示404警告,并且最后的结果也出错了。

#=#=-#  #
curl: (22) The requested URL returned error: 404 Not Found
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/manifests/0.2.5
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:83547fba540a38c30705a59a2e746952c68857212e823c6ee97c186e088f75cd
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:83547fba540a38c30705a59a2e746952c68857212e823c6ee97c186e088f75cd?se=2021-04-22T06%3A55%3
######################################################################## 100.0%
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/ruby-3.0.1.big_sur.bottle.tar.gz
==> Downloading from https://homebrew.bintray.com/ruby-3.0.1.big_sur.bottle.tar.gz
#=#=-#  #
curl: (22) The requested URL returned error: 404 Not Found
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/manifests/3.0.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/blobs/sha256:00daa93e4b30d3bbeac5089c1c34355315774e0d9fd1d9588402b2e755089c53
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:00daa93e4b30d3bbeac5089c1c34355315774e0d9fd1d9588402b2e755089c53?se=2021-04-22T06%3A55%3
######################################################################## 100.0%
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/vim-8.2.2775.big_sur.bottle.tar.gz
==> Downloading from https://homebrew.bintray.com/vim-8.2.2775.big_sur.bottle.tar.gz
#=#=-#  #
curl: (22) The requested URL returned error: 404 Not Found
Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/vim/manifests/8.2.2775
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/vim/blobs/sha256:2d48b73b8157241aef912e1fdc7e587837b60e4898f69d597b1f4182a520afe2
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:2d48b73b8157241aef912e1fdc7e587837b60e4898f69d597b1f4182a520afe2?se=2021-04-22T06%3A55%3
######################################################################## 100.0%
==> Installing dependencies for vim: gettext, lua, ncurses, openssl@1.1, berkeley-db, gdbm, perl, mpdecimal, readline, sqlite, xz, python@3.9, libyaml and ruby
==> Installing vim dependency: gettext
==> Pouring gettext-0.21.big_sur.bottle.tar.gz
tar: Error opening archive: Failed to open '/Users/username/Library/Caches/Homebrew/downloads/8835c3d1869eedf98376360b02e32e1ec1fcb790687cfa164713bea02c45e577--gettext-0.21.big_sur.bottle.tar.gz'
Error: Failure while executing; `tar --extract --no-same-owner --file /Users/username/Library/Caches/Homebrew/downloads/8835c3d1869eedf98376360b02e32e1ec1fcb790687cfa164713bea02c45e577--gettext-0.21.big_sur.bottle.tar.gz --directory /var/folders/7h/dkrm4zdd6bv315h44vqhx5pr0000gn/T/d20210422-22363-1sups7j` exited with 1. Here's the output:
tar: Error opening archive: Failed to open '/Users/username/Library/Caches/Homebrew/downloads/8835c3d1869eedf98376360b02e32e1ec1fcb790687cfa164713bea02c45e577--gettext-0.21.big_sur.bottle.tar.gz'

不会吧?一个用户基数这么大的服务,居然会出现这么多404 :mrgreen: ?去GitHub一查,好嘛,原来是bintray要关闭了,具体看这里,应该是截止到某个时间点,之后的包就没再往bintray传了,也就是404了。

其实Homebrew社区对这个问题早就做了准备的,新版的homebrew程序已经去除了bintray相关,使用ghcr.io服务了,所以只要正常使用,正常先update,再upgrade,是可以完美过渡,用户是无感的。

至于我为啥不行,是因为我用了清华大学的镜像,目前清华大学的镜像中依然是指向到bintray的,所以也跟着404了。所以要解决问题,那就是去掉清华大学的镜像设置就好了。具体的环境变量是$HOMEBREW_BOTTLE_DOMAIN。使用export HOMEBREW_BOTTLE_DOMAIN=''命令就可以去除。上面是临时修改,如果想永久修改,则需要去更新profile文件,zsh是~/.zprofile文件,bash要修改~/.bash_profile文件。

修改完后,再进行安装,就一切正常了。

我后来又去清华大学的GitHub上看了,已经有人反馈这个问题了,同时发现https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/ 目录下并没有直接列出各种包,反而多了一个bottles目录,想必清华大学已经是在处理这个问题,开始同步了吧。只是这个镜像有2.5T大,要完全同步完,真不知道猴年马月了。

本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: Homebrew MacOS
最后更新:2021年9月2日

Tink

这个人很懒,什么都没留下

点赞
< 上一篇

文章评论

  • qqleov

    嘿嘿,截止目前为止水木的镜像还没有完成同步

    2021年6月15日
    回复
    • Tink

      @qqleov 所以有条件还是用原生的吧,中间环节越多脆弱性越高。

      2021年6月17日
      回复
      • baizhu

        @Tink 404之后会默认回到原先的地址,感觉没影响
        curl: (22) The requested URL returned error: 404
        Warning: Bottle missing, falling back to the default domain...

        2021年6月18日
        回复
        • Tink

          @baizhu 目前我已经没再使用清华的镜像了,现在的情况我也不清楚,如果现在会自动跳转到ghcr.io的地址,我猜测是镜像上面做了一些适配。

          2021年6月21日
          回复
      • Garry Kasparov

        @Tink 非常赞同

        2021年7月6日
        回复
  • Haleclipse

    啊哈,很有帮助,一段时间没用突然嗝屁了看报错找不着北 :biggrin:

    2021年7月24日
    回复
  • yifei

    截止到目前,USTC 的镜像依然是有问题的。。

    2021年8月17日
    回复
  • imizao

    截止到目前,USTC 的镜像依然是有问题的。。

    2022年12月2日
    回复
  • Ankio

    截止到目前,USTC 的镜像依然是有问题的。

    2023年1月5日
    回复
  • razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
    取消回复

    最新 热点 随机
    最新 热点 随机
    Linux查看软件包是否默认安装 iOS 15 初体验,IP隐藏功能测试,还有Private Relay 修复homebrew安装软件404问题 macOS在iterm2使用touch ID Python实现命令行单行倒计时 一个无语的mysql问题
    黑科技解决MacOS App Store更新慢的问题 升级MacMojave 后brew无法使用 MacOS Mojave 升级体验 测试新版文章编辑器 聊聊MacBook Pro Linux查看软件包是否默认安装
    标签聚合
    分享 MacOS Mojave Wordpress MacOS CentOS Apple iOS Ubuntu
    归档
    • 2021年6月
    • 2021年4月
    • 2020年9月
    • 2020年3月
    • 2020年2月
    • 2019年5月
    • 2019年4月
    • 2019年1月
    • 2018年10月
    • 2018年9月

    COPYRIGHT © 2022 tinkol.com. ALL RIGHTS RESERVED.

    Theme Kratos Made By Seaton Jiang

    浙ICP备15016634号-1