How to remove a Brew package and all its dependencies?

TIL You can use the autoremove command to remove the leftovers from a package previously installed by brew.

  • List all the installed packages:
brew leaves
  • Remove an installed package:
brew uninstall [package]
  • Remove all the leftovers from an uninstalled package:
brew autoremove

When executing this command, pay attention to stdout. Brew does not clear some (config) files left from the autoremove command and it warnings you about that.