I want a way to uninstall packages that are not something that I requested be installed a dependency of something I requested be installed. In macports-land this can be done by port_cutleaves to trim unrequested packages that aren’t a dependency of a requested package and port installed requested to list the packages that you explicitly installed. My use cases is forgetting to include --without-xxx and ending up with a dozen things that I don’t want installed on my machine.
Sorry, there’s no way to do this yet as we don’t store this information.
brew leaves works for this usecase.
Good news, the
brew autoremove command has been added in the latest release and does exactly what you’re looking for!
Run it with
--dry-run if you want to see which formulae will be removed before actually removing them.
If I understood you correctly, I think
brew bundle dump does (most of) this. The
Brewfile it generates should only contain packages you explicitly requested.
You can then do
brew bundle cleanup to see the packages that are installed but you haven’t requested, or aren’t a dependent of one you’ve requested.