List all homebrew packages explicitly installed by the user (without deps)

homebrew

Is there a way to list all the homebrew packages explicitly installed by the user (they they installed directly using brew install)?

Note brew leaves doesn't do this. Over time formula can change change their dependencies leaving orphaned leaves that were never explicitly installed by the user or adding dependencies on previously explicitly installed packages.

Best Answer

Seems that you can use brew bundle:

brew bundle dump --file /tmp/x
brew bundle list --file /tmp/x --formula

the temporary file can be avoided using pipes

brew bundle dump --file - | brew bundle list --file - --formula