6

Is there a way to list all the homebrew packages explicitly installed by the user (they they installed directly using brew install)?

Note brew leaves doesn't do this. Over time formula can change change their dependencies leaving orphaned leaves that were never explicitly installed by the user or adding dependencies on previously explicitly installed packages.

2 Answers 2

6

Simple mode using brew bundle

We can list all taps, formulae and casks that were added by the user on stdout:

brew bundle dump --file -

Or we can do it manually, without using brew bundle.

Listing all brew taps

brew tap

Listing all brew formulae installed on request

This ignores any formulae that were added automatically as dependencies, but unlike brew leaves will still show any packages that are dependencies if you installed them manually as well, and avoids listing 'orphaned' packages:

brew info --json=v2 --installed \
    | jq -r '.formulae[]|select(any(.installed[]; .installed_on_request)).full_name'

Listing all brew casks installed

At the time of writing (2022-03-20) brew doesn't keep track of which casks were installed on request, but few if any casks are dependencies for other casks/formulae, so we can simply list them all:

brew list --cask -l1
1
  • Nice. I prefer your info/jq method of finding formulas installed explicitly. Mar 21 at 0:04
3

Seems that you can use brew bundle:

brew bundle dump --file /tmp/x
brew bundle list --file /tmp/x --formula

the temporary file can be avoided using pipes

brew bundle dump --file - | brew bundle list --file - --formula

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .