卸载/删除包括其所有依赖项的Homebrew软件包 [英] Uninstall / remove a Homebrew package including all its dependencies

查看:1710
本文介绍了卸载/删除包括其所有依赖项的Homebrew软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Homebrew 公式,希望与所有依赖关系一起卸载/删除,而跳过其他软件包所依赖的软件包(又名

I have a Homebrew formula that I wish to uninstall/remove along with all its dependencies, skipping packages whom other packages depend upon (a.k.a. Cascading package removal in Package manager parlance).

例如卸载依赖于软件包b&的软件包a. c,其中包d也依赖于包c.结果应同时卸载a& b,跳过c.

e.g. Uninstall package a which depends on packages b & c, where package d also depends on package c. The result should uninstall both a & b, skipping c.

我该怎么做?

必须有一种方法可以卸载软件包,而不会留下不必要的垃圾.

There must be a way to uninstall a package without leaving unnecessary junk behind.

推荐答案

看起来像现在,该问题已使用名为brew rmdeps的外部命令解决了或brew rmtree .

It looks like the issue is now solved using an external command called brew rmdeps or brew rmtree.

要安装和使用,请发出以下命令:

To install and use, issue the following commands:

$ brew tap beeftornado/rmtree
$ brew rmtree <package>

有关更多信息和讨论,请参见上面的链接.

See the above link for more information and discussion.

目前看来,没有简单的方法可以完成此操作.

It appears that currently, there's no easy way to accomplish this.

但是,我在Homebrew的GitHub页面上提出了问题,有人建议临时解决方案,直到他们添加专用命令来解决此问题.

However, I filed an issue on Homebrew's GitHub page, and somebody suggested a temporary solution until they add an exclusive command to solve this.

有一个名为brew leaves外部命令,它会打印所有而不是其他软件包的依赖项.

There's an external command called brew leaves which prints all packages that are not dependencies of other packages.

如果您对brew leavesbrew deps <package>的输出执行逻辑 ,则可能仅会得到孤立的依赖项包的列表,您可以之后手动卸载.将此与xargs结合使用,我想您会得到所需的东西(未经测试,请勿指望).

If you do a logical and on the output of brew leaves and brew deps <package>, you might just get a list of the orphaned dependency packages, which you can uninstall manually afterwards. Combine this with xargs and you'll get what you need, I guess (untested, don't count on this).

编辑:有人刚刚提出了一个非常相似的解决方案,使用join而不是xargs:

Somebody just suggested a very similar solution, using join instead of xargs:

brew rm FORMULA
brew rm $(join <(brew leaves) <(brew deps FORMULA))


有关更多信息,请参见评论.

这篇关于卸载/删除包括其所有依赖项的Homebrew软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆