Uninstall / remove a Homebrew package including al

2019-01-15 23:30发布

I have a Homebrew package that I wish to uninstall / remove with all its dependencies, skipping packages whom other packages depend upon.

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.

How can I do that?

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

9条回答
\"骚年 ilove
2楼-- · 2019-01-16 00:20

The answer of @jfmercer must be modified slightly to work with current brew, because the output of brew missing has changed:

brew deps [FORMULA] | xargs brew remove --ignore-dependencies && brew missing | cut -f1 -d: | xargs brew install
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-16 00:20

The goal here is to remove the given package and its dependencies without breaking another package's dependencies. I use this command:

brew deps [FORMULA] | xargs brew remove --ignore-dependencies && brew missing | xargs brew install

Note: Edited to reflect @alphadogg's helpful comment.

查看更多
放我归山
4楼-- · 2019-01-16 00:20

brew rmtree doesn't work at all. From the links on that issue I found rmrec which actually does work. God knows why brew doesn't have this as a native command.

brew tap ggpeti/rmrec
brew rmrec pkgname
查看更多
登录 后发表回答