Homebrew: List Only Top Level Installed Formulas

I am looking for a way to show only the formulas that I installed without the dependencies installed. I want to have a list of all the programs that I actually installed, without any dependency noise.

I know about the brew list , which lists all the installed formulas. I also know that brew graph gives me a dependency graph in graphviz

Or, in other words: I want to have a minimal set of formulas to reinstall my system.

+79
homebrew
Feb 13 '14 at 15:31
source share
3 answers

Use brew leaves : show installed formulas that are not dependencies of another established formula.

+128
Mar 31 '14 at 23:37
source share
 $ 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?

+17
Mar 28 '14 at 13:19
source share

it shows the established formulas in the form of a tree.

brew deps --installed - tree

0
Feb 03 '19 at 21:21
source share



All Articles