$ brew deps --installed tmux: pkg-config libevent q: gdbm: libxml2: asciidoc: docbook libevent: pkg-config: pcre: docbook: zsh: gdbm pcre readline: emacs: pkg-config
This seems to give us a list of all installed formulas, including their dependencies. We can build a list of all formulas and a list of all the dependencies and subtract the dependencies from the list of formulas, this should give us a list of formulas that are not dependencies of other formulas:
$ cat brew-root-formulae.sh #!/bin/sh brew deps --installed | \ awk -F'[: ]+' \ '{ packages[$1]++ for (i = 2; i <= NF; i++) dependencies[$i]++ } END { for (package in packages) if (!(package in dependencies)) print package }'
.
$ ./brew-root-formulae.sh zsh asciidoc libxml2 readline tmux q emacs
Is this the result you are after?
Adrian Frühwirth Mar 28 '14 at 13:19 2014-03-28 13:19
source share