Is there anyway to have the command brew
show all the installed or optional dependencies for any given package? It would also be helpful to see which of the install packages are themselves the dependencies of others packages.
103
votes
5 Answers
204
votes
brew deps --tree --installed
Thanks to rob-kovacs for suggesting the --tree
addition
See this super 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.
61
votes
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)/"
45
votes
20
votes
I found the brew deps --tree
switch is also very helpful to visualize dependencies just in the command line. From the official doc:
brew deps --tree [--1] [filters] [--annotate] (formulae|--installed):
Show dependencies as a tree. When given multiple formula arguments, output
individual trees for every formula.
Example1:
brew deps --tree fontconfig
Output1:
fontconfig
└── freetype
└── libpng
Example2:
brew deps --tree --1 fontconfig
Output2:
fontconfig
└── freetype
and there are more switches explained by:
brew help deps