indaclouds.fr

Some tips when I take time to write them down.

List homebrew packages with their dependencies


Homebrew is for me the package manager to use for OS X. I use it for almost 3 years now. Its simplicity of installation and utilisation do that I can’t go back to Macports or Fink.

The goal of the article is not to show how Homebrew works but only show how to display installed packages and their dependencies.

To display installed packages, no more simple :

brew list or brew ls

But sometimes, you want to check what packages are installed and what are their dependencies. 2 years ago, I found someone with the same question as me on stackoverflow but I am not able to find the link.

Hopefully, I saved the command line used for this so I can share it here. This one is for ZSH and does not work with bash.

brew list | while read cask; do echo -n $fg[blue] $cask $fg[white]; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done

This command is helpful but does not list orphan packages. So if you want to see if a package isn’t required by another, you have to search and find with the terminal. Not the best way but it works.

UPDATE 2017-01-19: I found the original post about the previous command here.