On a new machine, I used brew to install only four things: git
, node
, sqlite
and less
. Later on, when I ran brew update
I was told many other things that I didn't install were "outdated". I ran brew list
and got the following:
brotli less pcre2
c-ares libnghttp2 [email protected]
ca-certificates libuv readline
gdbm mpdecimal sqlite
gettext ncurses xz
git node
icu4c [email protected]
Where did these come from? If they were installed because git
, node
or less
needs them, how do I find out?
This matters because I only want to consider updating packages that I specifically installed, and leave decisions about updating dependencies to the packages that depend on them.
Yes, Homebrew (aka brew), like all package managers, automatically installs dependencies, things needed for something else to work. This is a recursive process: If the dependency itself has dependencies, brew will install them too, and so on. brew list
shows you everything installed on your system, including all these dependencies.
To see just the list of what you yourself installed, see the end of this answer.
brew deps
You can see the dependency tree for anything you installed using the brew deps
command:
> brew deps node --tree
node
├── brotli
├── c-ares
├── icu4c
├── libnghttp2
├── libuv
├── [email protected]
│ └── ca-certificates
└── [email protected]
├── gdbm
├── mpdecimal
├── [email protected]
│ └── ca-certificates
├── readline
├── sqlite
│ └── readline
└── xz
You can see in this tree many of the things you saw in brew list
.
brew uses
But to answer part of your question, you can go in the opposite direction using the brew uses
command:
> brew uses readline --installed
node [email protected] sqlite
The --installed
flag is important, because without it the above command will list everything that uses readline
, whether it is installed on your system or not. Notice also how brew uses
is recursive (in the opposite direction as brew deps
), showing both [email protected]
which uses readline
directly, and node
, which uses it indirectly.
brew desc
Now if you're curious as to what any of these installed dependencies do, use the brew desc
command:
> brew desc pcre2
pcre2: Perl compatible regular expressions library with a new API
brew list --installed-on-request
Finally, to just get a list of what you specifically installed, just add --installed-on-request
to brew list
:
> brew list --installed-on-request
git
less
node
rar
sqlite