LinuxCommandLibrary

brew-update

Update Homebrew and its package recipes

TLDR

Fetch the newest version of Homebrew and all formulae

$ brew [[up|update]]
copy

SYNOPSIS

brew update [options]

PARAMETERS

--force
    Force update, ignoring up-to-date status

--merge
    Use git merge instead of git reset --hard

--preinstall
    Preinstall mode for macOS installer compatibility

--debug
    Enable debug logging and tracing

--verbose
    Print more detailed output

--quiet
    Suppress non-essential output

--help
    Display help message

DESCRIPTION

brew update is a command from Homebrew, the popular package manager for macOS and Linux (via Homebrew-on-Linux). It refreshes the Homebrew installation and downloads the latest package definitions (formulae) from GitHub repositories.

Executing brew update performs a git fetch and reset (or merge with --merge) on the core tap (/opt/homebrew or ~/.linuxbrew), ensuring access to the newest software versions, casks, and taps. It also self-updates Homebrew if a newer version exists.

On Linux, Homebrew installs user-owned binaries in $HOMEBREW_PREFIX (default: /home/linuxbrew/.linuxbrew), avoiding root privileges and system package conflicts. It's crucial before brew install, brew upgrade, or brew outdated to reflect current package states.

The command runs quickly with internet access and git (auto-installed if missing). It reports changes like 'Updated 2 taps (homebrew/core, homebrew/cask)' or 'Already up-to-date'. Regular use maintains a healthy prefix and enables features like auto-update hooks.

Note: Not native to Linux; requires prior Homebrew setup via install script.

CAVEATS

Requires internet and git; on Linux, may need glibc/libgcc adjustments. Avoid mixing with apt/yum/dnf. Large repos can take time on slow connections.
Conflicts possible if system paths overlap.

INSTALLATION ON LINUX

Run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add to PATH: eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

AUTOMATION

Enable with brew autoupdate start for periodic runs. Use BREW_UPDATE_BEFORE=1 brew ... env var to force before commands.

HISTORY

Homebrew created 2009 by Max Howell for macOS. Linuxbrew fork by Michka Popov in 2013 for portability. Merged into core Homebrew 2018 (v2.0+), enabling native Linux support with cellared installs.

SEE ALSO

Copied to clipboard