LinuxCommandLibrary

brew

Install, update, and manage software packages

TLDR

Install the latest stable version of a formula or cask (use --devel for development versions)

$ brew install [formula]
copy

List all installed formulae and casks
$ brew list
copy

Upgrade an installed formula or cask (if none is given, all installed formulae/casks are upgraded)
$ brew upgrade [formula]
copy

Fetch the newest version of Homebrew and of all formulae and casks from the Homebrew source repository
$ brew update
copy

Show formulae and casks that have a more recent version available
$ brew outdated
copy

Search for available formulae (i.e. packages) and casks (i.e. native macOS .app packages)
$ brew search [text]
copy

Display information about a formula or a cask (version, installation path, dependencies, etc.)
$ brew info [formula]
copy

Check the local Homebrew installation for potential problems
$ brew doctor
copy

SYNOPSIS

brew [options] [command_options] [arguments]

PARAMETERS

install formula
    Install a specified formula (package).

uninstall formula
    Uninstall a specified formula.

search text|regex
    Search for available formulae by name or description.

update
    Update Homebrew itself and all formulae from Git.

upgrade [formula]
    Upgrade outdated formulae. If a formula is specified, only that one is upgraded.

list
    List all installed formulae.

info formula
    Display detailed information about a specified formula.

doctor
    Check your system for potential problems or misconfigurations related to Homebrew.

cleanup
    Remove stale lock files and old downloads for installed formulae.

deps formula
    Show the dependencies of a specified formula.

tap user/repo
    Add an external formula repository (tap) to Homebrew.

untap user/repo
    Remove a previously added external formula repository (tap).

DESCRIPTION

Homebrew is a free and open-source software package management system that simplifies the installation of software primarily on Apple's macOS operating system, but also fully supports Linux (as Linuxbrew). It allows users to install a wide range of Unix tools, utilities, and applications not typically pre-installed by default on many Linux distributions. Homebrew compiles software from source or installs pre-compiled binaries (bottles), managing dependencies automatically.

It installs packages to their own directories and then symlinks their files into a designated prefix (e.g., /home/linuxbrew/.linuxbrew on Linux). This design makes it easy to upgrade, uninstall, or roll back packages without affecting the system's core. Its "formulae" are Ruby scripts that describe how to build and install software. Homebrew is widely adopted for its simplicity, extensibility, and user-friendly command-line interface, providing a comprehensive ecosystem for developers and power users on both platforms.

CAVEATS

Primarily developed for macOS, its Linux support (Linuxbrew) might have some specific considerations. It installs packages to its own prefix (/home/linuxbrew/.linuxbrew by default on Linux) which might require careful management of system paths to avoid conflicts. Homebrew is a user-level package manager and does not replace system-level package managers like apt or dnf for core system components.

FORMULAE AND CASKS

Homebrew uses "formulae" (Ruby scripts) to define how to build and install command-line tools and libraries from source or pre-compiled binaries. While "casks" are primarily used for installing macOS graphical applications, their direct relevance for brew on Linux is minimal, as Linux users typically rely on native methods for GUI application management.

USER-SPACE INSTALLATION

A distinguishing feature of Homebrew is its user-space installation model. Unlike traditional system package managers that install software globally requiring root privileges, Homebrew installs packages into a user-writable directory (e.g., /home/linuxbrew/.linuxbrew on Linux). This allows users to manage their own software and development environments without needing sudo access for every package installation, offering greater flexibility and security.

HISTORY

Homebrew was created by Max Howell in 2009 for macOS, aiming to simplify software installation beyond Apple's pre-installed utilities. Its design principles emphasized simplicity, extensibility via Ruby formulae, and user-centric package management. It gained immense popularity on macOS, becoming the de facto standard for developers. In 2016, a fork named Linuxbrew was created to bring Homebrew's features to Linux distributions, eventually merging back into the main Homebrew project as official Linux support. This expansion made brew a truly cross-platform package manager, extending its reach and utility to a broader developer community.

SEE ALSO

apt(8), dnf(8), pacman(8), snap(1), flatpak(1), make(1), gcc(1)

Copied to clipboard