LinuxCommandLibrary

brew-leaves

List Homebrew leaf packages

TLDR

List installed formulas that are not dependent on other installed formulas or casks

$ brew leaves
copy

Only list leaves that were manually installed
$ brew leaves [[-r|--installed-on-request]]
copy

Only list leaves that were installed as dependencies
$ brew leaves [[-p|--installed-as-dependency]]
copy

Display help
$ brew leaves [[-h|--help]]
copy

SYNOPSIS

brew leaves

DESCRIPTION

brew-leaves is a utility command provided by Homebrew, the popular package manager for macOS and Linux. Its primary function is to identify and list all installed packages that are 'leaf' packages. A leaf package is one that has been installed but is not a dependency of any other currently installed package. In simpler terms, these are the top-level applications or libraries that you explicitly chose to install, rather than being pulled in automatically by other installations.

This command is particularly useful for auditing your Homebrew installations, identifying software that might no longer be needed, or understanding the core components of your development environment. It helps in distinguishing between user-installed software and its intricate dependency tree. brew-leaves does not accept any command-specific options or arguments, making its usage straightforward and focused.

CAVEATS

This command requires Homebrew to be installed and configured on your system (macOS or Linux). It is not a standard POSIX or GNU/Linux utility and will not be available without Homebrew. Its output is entirely dependent on your current Homebrew package installations and their dependency relationships.

UNDERSTANDING LEAF PACKAGES

In the context of package management, a leaf package is a package that is not listed as a dependency for any other currently installed package. This means it was either explicitly installed by the user, or it's a root dependency of some other package that has since been uninstalled. Identifying leaf packages is crucial for system maintenance, as they represent the software the user directly interacts with or intended to install, rather than infrastructure components pulled in by other applications.

PRIMARY USE CASES

brew leaves is invaluable for:

  • Auditing your installed software to see what you've directly installed.
  • Identifying packages that might be candidates for uninstallation if no longer needed, helping to declutter your system.
  • Understanding the core components of your development environment by showing the explicitly chosen tools and libraries.

HISTORY

brew leaves has been a fundamental part of the Homebrew ecosystem since its early days, providing users with a clear and concise view of their top-level installations. Its design reflects Homebrew's philosophy of simplicity and clarity in package management, enabling users to easily distinguish between explicitly installed software and its underlying dependencies. It serves as a vital tool for maintaining a lean and understandable package environment.

SEE ALSO

brew list(1), brew deps(1), apt autoremove(8), dnf autoremove(8)

Copied to clipboard