LinuxCommandLibrary

brew-list

List installed Homebrew packages

TLDR

List all installed formulae and casks

$ brew list
copy

List files belonging to an installed formula
$ brew list [formula]
copy

List artifacts of a cask
$ brew list [cask]
copy

List only formulae
$ brew list --formula
copy

List only casks
$ brew list --cask
copy

List only pinned formulae
$ brew list --pinned
copy

SYNOPSIS

brew list [options] [formula]
brew list --formula
brew list --cask
brew list --full-name
brew list --unbrewed
brew list --versions
brew list --json=version
brew list --verbose

PARAMETERS

--formula, -f
    Lists only installed formulae (default if no package specified).

--cask, -c
    Lists only installed casks (graphical applications).

--full-name
    Prints formulae and casks with their full tap names (e.g., homebrew/core/git instead of git).

--unbrewed
    Lists files found in the Homebrew prefix that were not installed by Homebrew.

--versions
    Displays the version number for each installed formula.

--json=version
    Outputs package data in JSON format. version can be v1 or v2.

--verbose, -v
    Provides more detailed output, including keg path for formulae.

[formula]
    When a formula name is provided, lists all files installed by that specific formula.

DESCRIPTION

The `brew list` command is a fundamental subcommand of Homebrew, a popular open-source package manager designed primarily for macOS, but also fully supported on Linux. Its primary function is to display a comprehensive list of all software packages – known as formulae for command-line tools and libraries, and casks for graphical applications – that have been installed on the system using Homebrew.

When invoked without any arguments, `brew list` provides a simple, alphabetically sorted output of all installed formulae. Users can refine this output significantly by employing various options. For instance, one can specify to only list casks, show the full names of packages, or display the version numbers of installed formulae. A particularly powerful feature is its ability to list all individual files installed by a specific formula when that formula's name is provided as an argument. This makes it invaluable for debugging, understanding installation paths, and ensuring system cleanliness.

Essentially, `brew list` acts as an inventory tool for your Homebrew-managed software, helping users keep track of their installed environment, prepare for upgrades, or identify packages for uninstallation. It's a cornerstone command for anyone leveraging Homebrew for software management on their Linux or macOS system.

CAVEATS

The command `brew list` is part of the Homebrew package manager and is not a standard, standalone Linux utility included in most distributions by default. It requires Homebrew to be installed on your system.

The `--versions` option is primarily designed for formulae and may not provide meaningful output for casks. The exact structure of the `--json` output can vary significantly between v1 and v2 versions, requiring careful parsing.

OUTPUT BEHAVIOR

By default, `brew list` prints installed packages one per line. When listing files for a specific formula, it outputs paths relative to the Homebrew prefix (e.g., /usr/local on macOS, or ~/.linuxbrew on Linux).

The command returns an exit status of 0 upon successful execution, and a non-zero status if an error occurs, such as an invalid option or a non-existent formula.

ENVIRONMENT VARIABLES

Homebrew's behavior, including that of `brew list`, can be influenced by various environment variables. For instance, HOMEBREW_PREFIX defines the installation root, affecting where `brew list` looks for installed packages. Other variables like HOMEBREW_NO_COLOR can alter output formatting.

HISTORY

Homebrew, and thus the `brew list` command, was conceived by Max Howell and first launched in 2009 as a package manager primarily for macOS. Its utility quickly led to widespread adoption.

In 2017, the separate Linuxbrew project, which brought Homebrew's capabilities to Linux, was officially merged into the main Homebrew repository, extending `brew`'s reach beyond macOS. The `list` subcommand has been a core and indispensable part of Homebrew since its inception, continually evolving with new options (like `--cask`, `--versions`, `--json`) to support the growing complexity and feature set of the package manager, making it crucial for package auditing and management across both platforms.

SEE ALSO

brew(1), brew install(1), brew uninstall(1), brew upgrade(1), brew search(1), man(1), apropos(1)

Copied to clipboard