macos brew 安装被禁止(disable)的Homebrew软件包的方法 - Error: xxx has been disabled because it is not supported

14 篇文章 0 订阅

最近在macos上面使用 brew install mariadb@10.3 居然提示 Error: mariadb@10.3 has been disabled because it is not supported upstream!  查阅后发现这个版本官方于2024年5月停止维护,所以在brew安装时就提示了不受支持的异常。 

brew安装被禁止 disable 软件包的方法

下面以 mariadb@10.3 为例说明安装方法:

1. 首先 brew edit [formula] 删除 disable 哪一行, 如 brew edit mariadb@10.3

执行这个命令后就会在编辑器中打开对应的brew formula,然后找到提示异常信息那一行,把他注释了保存。   brew edit xxx 命令实际上就是帮我们直接打开对应的 xxx.rb文件, 如下:

 如上图所示, 注释掉提示异常的这行, 可能是 deprecate!  或者 disable! 等, 

2. 在在brew安装命令前面增加环境变量设置HOMEBREW_NO_INSTALL_FROM_API=1  即

HOMEBREW_NO_INSTALL_FROM_API=1 brew install mariadb@10.3

HOMEBREW_NO_INSTALL_FROM_API=1  这个环境变量的作用就是告诉brew 不使用api中的formula而是使用你自己编辑后的, 这样就可以正常安装被brew禁止disable的软件包了。

brew 相关常见问题官方文档

Can I edit formulae myself?

Yes! It’s easy! If brew tap doesn’t show homebrew/core, set yourself up to edit a local copy:

  1. Set HOMEBREW_NO_INSTALL_FROM_API=1 in your shell environment,
  2. Run brew tap --force homebrew/core and wait for the clone to complete, then
  3. Run brew edit <formula> to open the formula in EDITOR.

You don’t have to submit modifications back to homebrew/core, just edit the formula to what you personally need and brew install <formula>. As a bonus, brew update will merge your changes with upstream so you can still keep the formula up-to-date with your personal modifications!

Note that if you are editing a core formula or cask you must set HOMEBREW_NO_INSTALL_FROM_API=1 before using brew install or brew update otherwise they will ignore your local changes and default to the API.

To undo all changes you have made to any of Homebrew’s repositories, run brew update-reset. It will revert to the upstream state on all Homebrew’s repositories.

更多brew常见问题文档FAQ (Frequently Asked Questions) — Homebrew Documentation

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值