Easy way to have Homebrew list all package dependencies

Here is a command that will list all formulas that aren't dependents of any other formulas (leaves), and for each of them lists all of its dependencies.

Sample output line:

awscli: gdbm readline sqlite tcl-tk xz

Command:

brew leaves | xargs brew deps --installed --for-each | sed "s/^.*:/$(tput setaf 4)&$(tput sgr0)/"

For all packages:

brew deps --tree --installed

For one package only (e.g.):

brew deps --tree --installed vim

Thanks to rob-kovacs for suggesting the --tree addition

See this helpful article for details: https://blog.jpalardy.com/posts/untangling-your-homebrew-dependencies/ Especially if you're interested in creating a graph of the dependency tree.