26

There is the awesome vanilla list:

$ brew list | cat
[...]
libevent
[...]
net-snmp
[...]
openssl
[email protected]
[...]

Let's say I want to check which packages can I remove because I no longer need. I would need a way to forge such list, because if I try to randomly remove a package, e.g. [email protected]:

$ brew remove [email protected]
Error: Refusing to uninstall /usr/local/Cellar/[email protected]/1.1.0f
because it is required by net-snmp, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies [email protected]
$ _

So my desired output would be:

$ /PATH/TO/brew_dependency_tree_leaves_list.sh
[...]
libevent
[...]
net-snmp
[...]
$ _

I don't know if net-snmp can be depended by any. It is not in my scenario. libevent is also depended upon by something else, but please abstract that.

How to?

2
  • “brew list” on its own should work (without “cat”).
    – JBallin
    Commented Sep 14, 2019 at 13:56
  • "brew list" shows me a matrix of names that woulda made my OP editing harder.
    – 146438
    Commented Sep 14, 2019 at 14:00

1 Answer 1

50
+50
brew leaves

Docs:

List installed formulae that are not dependencies of another installed formula.

You can also use --installed-on-request or --installed-as-dependency to understand the reason a package was installed.

1
  • 3
    Now my Homebrew installation is clear, minimal, without superfluous packages no longer necessary. I had been collecting stuff for years and my installation was very cluttered.
    – 146438
    Commented Sep 14, 2019 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .