LinuxCommandLibrary

brew

Install, update, and manage software packages

TLDR

Install the latest stable version of a formula or cask

$ brew install [formula|cask]
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|cask]
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|cask]
copy

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

SYNOPSIS

brew [global-options...] command [formula|cask]... [options]

PARAMETERS

--help
    Show general help or for specific command

--version
    Display Homebrew version

--verbose
    More logging during execution

--quiet
    Suppress output

--debug
    Enable debug mode

--force
    Override safeguards

install
    Install formula/cask with dependencies

uninstall
    Remove formula/cask and dependencies

list
    List installed formulae/casks

search
    Search available formulae/casks

update
    Fetch latest formulae/cask definitions

upgrade
    Upgrade outdated formulae/casks

info
    Show details about formula/cask

doctor
    Check system for common issues

cleanup
    Remove old downloads and cache

DESCRIPTION

brew is the primary command for Homebrew, an open-source package manager that installs, updates, and manages software on macOS, Linux, and Windows (via WSL). On Linux, it creates a self-contained cellar in ~/.linuxbrew or /home/linuxbrew/.linuxbrew, preventing conflicts with native managers like apt or dnf.

It handles formulae (CLI apps, libraries) and casks (GUI apps on macOS), resolving dependencies automatically from a vast GitHub repository. Core workflow: update formulae lists, install packages, and upgrade as needed. For example, brew install wget fetches, compiles, and links wget.

Benefits include version pinning, easy rollbacks, and portability. It supports taps (external repos) for niche software. On Linux, it excels for developer tools absent or outdated in distro repos, like recent Node.js or Rust. However, large installs consume disk space due to source builds.

With over 8,000 formulae, brew empowers users with a Ruby-based DSL for custom packages, fostering a community-driven ecosystem.

CAVEATS

On Linux, adjust PATH carefully to prioritize /home/linuxbrew/.linuxbrew/bin; avoid mixing with system packages to prevent DLL hell. Builds from source are slow/resource-intensive. Not for production servers.

INSTALLATION

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

QUICK START

brew update
brew upgrade
brew install git wget htop
brew doctor to verify setup

HISTORY

Created by Max Howell in 2009 for macOS to ease Ruby dev. Linuxbrew forked in 2014 by Michka Popov for portability. Projects merged in 2020, unifying under Homebrew with native Linux support. Now maintained by Homebrew team on GitHub.

SEE ALSO

apt(8), dnf(8), pacman(8), yum(8), nix(1)

Copied to clipboard