LinuxCommandLibrary

brew-search

Search Homebrew for available packages

TLDR

Search for casks and formulae using a keyword

$ brew search [keyword]
copy

Search for casks and formulae using a regex
$ brew search /[regex]/
copy

Enable searching through descriptions
$ brew search --desc [keyword]
copy

Only search for formulae
$ brew search --formula [keyword]
copy

Only search for casks
$ brew search --cask [keyword]
copy

SYNOPSIS

brew search [options] [text|/regex/]

Common usage examples:
brew search git
brew search /^ruby-/
brew search --desc editor
brew search --cask firefox
brew search --formula python

PARAMETERS

text|/regex/
    The search query. Can be a simple string (case-insensitive substring match) or a regular expression enclosed in forward slashes (/). Matches against package names.

--desc, -d
    Searches for formulae and casks whose descriptions contain the specified text or match the regular expression, instead of their names.

--formula, -f
    Limits the search results to formulae only (command-line tools and libraries).

--cask, -c
    Limits the search results to casks only (macOS applications). --macapps is an alias for this option.

--eval-all
    Forces Homebrew to evaluate all available formulae and casks in all taps, even those not yet tapped. This can be significantly slower but ensures a comprehensive search.

--json
    Outputs the search results in JSON format, providing structured data including name, description, and whether it's an exact match.

--arch architecture
    Filters search results to show packages compatible with or specific to the given CPU architecture (e.g., arm64, x86_64).

DESCRIPTION

brew search is a fundamental command within the Homebrew package manager, used to discover available software packages (known as formulae for command-line tools and libraries, and casks for macOS applications). It enables users to locate packages by providing a name, a partial name, or a regular expression. By default, the command searches the names of all available formulae and casks across Homebrew Core taps and any other taps the user has installed. The search operation is case-insensitive by default. Beyond just names, brew search can also delve into the descriptions of packages or even the content of formulae files, which is invaluable for identifying tools based on their functionality or dependencies. This command is crucial for exploring the vast Homebrew ecosystem, ensuring users find the precise package they need before proceeding with installation.

CAVEATS

brew search relies on the Homebrew package manager being installed and configured correctly. For the most up-to-date and accurate results, it is recommended to run brew update prior to searching, as this refreshes Homebrew's local index of available packages. Searching with --eval-all or overly broad regular expressions can consume significant time and system resources due to the extensive evaluation required. By default, the search is case-insensitive for convenience.

HOMEBREW CONTEXT

It's important to understand that brew search is not a standalone Linux command but a subcommand of Homebrew, a popular package manager. While primarily associated with macOS, Homebrew (and thus its brew search command) can also be used on Linux distributions via Linuxbrew, offering a consistent package management experience across different Unix-like systems.

SEARCH MECHANISM

When you execute brew search, Homebrew first checks its local cache of formulae and casks. If the cache is outdated or a comprehensive search is requested (e.g., with --eval-all), it may fetch and evaluate remote tap information. The command distinguishes between exact matches (which are highlighted) and partial matches, and can also search within descriptions or the content of formula files themselves, providing a versatile discovery tool for the Homebrew ecosystem.

HISTORY

The Homebrew project was initiated in 2009 by Max Howell as a package manager for macOS. The brew search command has been a core and indispensable part of Homebrew since its early development, providing users with the primary means to discover software. Over the years, its functionality has been extended to include searching for casks (introduced in 2013), support for regular expressions, searching by description, and the addition of structured JSON output for programmatic use. Its continuous evolution reflects Homebrew's commitment to providing a robust and user-friendly package management experience.

SEE ALSO

brew(1), brew install(1), brew info(1), brew list(1), brew update(1), regex(7)

Copied to clipboard