Is it possible to and how do I get a list of all the packages installed on my Mac using
Homebrew? I am not interested in packages installed outside of Homebrew.
brew list and
brew cask list
brew list will show a list of all your installed Homebrew packages.
brew cask list will provide the items installed using Homebrew Cask.
brew bundle may also be interesting if you are asking because you want to manage your brew installation. This includes casks, which
brew list does not. It is aimed at having reproducible Homebrew setups.
# creates Brewfile in the current directory from currently-installed packages brew bundle dump # edit Brewfile # install everything from the Brewfile brew bundle
You can use the
--global flag to operate on your
-f/--force to force overwriting of your existing file (for installation, this will force uninstallation of not-listed packages).
brew list command shows a simple, alphabetically sorted list of all the installed packages.
However, various required packages (dependencies) get automatically installed when installing a package using Homebrew. It is possible to view the list of all the installed packages as a nicely formatted dependency tree. To view it, execute the following command:
brew deps --tree --installed
An example output is as shown below:
gdbm openssl python ├── gdbm ├── openssl ├── readline ├── sqlite │ └── readline └── xz readline sqlite └── readline xz
The independently listed packages (e.g.
openssl in the example output above) have no dependencies. The packages depicted as part of a tree structure have their dependency listed at immediate lower level (e.g. package
sqlite requires that the package
readline to be installed). The packages listed at leaf nodes in the tree structures have no dependencies.
Dependencies visualised in a tree structure can help in easily getting rid of the unnecessary packages.
You can use this snippet to list all installed packages and sort them by their size.
Others have mentioned
brew leaves, which lists things that aren't dependencies; and
brew deps --tree --installed which lists the dependency tree for all installed packages.
I find the most useful output of any answers yet is the combination of these.
brew deps --tree $(brew leaves)
This will list the complete tree of your brew install.