d6fryq
Last Updated: February 25, 2016
·
1.309K
· colindean
E3c791e8e5da39bf88b09dfb089de01b

Generate a graph of Homebrew dependencies

Firstly, ensure that graphviz is installed with brew install graphviz.

You'll need to somehow get the graph command in one of two ways:

  1. Tap the boneyard with brew tap homebrew/boneyard. This will install an older version of the command, written in Python that parses brew deps. It may stop working as time goes on.
  2. Copy the brew-graph script from this project to somewhere on your PATH. It hasn't been updated in a while, so YMMV. You will have to write the data to a file with -o filename and modify the command below to read from that file until issue #2 is fixed.

Then you can do this with the Python version:

brew graph | dot -Tgif > deps.gif

Or this with the Ruby version:

brew graph -g all -o graph.dot
cat graph.dot | dot -Tgif > deps.gif
open deps.gif

This will generate something like this:

Picture

Use gif instead of png for this, as the image is only a few colors and otherwise ends up being huge.

Say Thanks
Respond

2 Responses
Add your response

17546
B25f23c9d904010ec17b249272555c49 normal

I think you may be missing the installation of something that provides the 'graph' command for brew?

/tmp$ brew graph
Error: Unknown command: graph
over 1 year ago ·
17549
E3c791e8e5da39bf88b09dfb089de01b

@grempe: It seems to have been removed. I can't seem to find when, but this project seems to provide at least the command. I've not tried it yet, though.

Edit: Found it. In commit 2496da48b34ee183b6873e090e91b0adf87cb674, brew-graph was moved to homebrew-boneyard. You can install the original with brew tap homebrew/boneyard, but it's probably better to use the aforementioned script, which tightly integrates with Homebrew, but hasn't been updated in years.

over 1 year ago ·