LinuxCommandLibrary

brew-reinstall

Reinstall Homebrew packages

TLDR

Reinstall a formula/cask

$ brew reinstall [formula|cask]
copy

Reinstall a formula/cask and show verification and post-install steps
$ brew reinstall [[-v|--verbose]] [formula|cask]
copy

Make some output more quiet
$ brew reinstall [[-q|--quiet]] [formula|cask]
copy

Display help
$ brew reinstall [[-h|--help]]
copy

SYNOPSIS

brew reinstall [options] formula ...

PARAMETERS

--debug
    Enable debug output for troubleshooting.

--force
    Reinstall even if dependencies rely on it; overwrites existing installs.

--force-bottle
    Install from bottle even if it mismatches the prefix architecture.

--quiet
    Suppress non-error output.

--verbose
    Print step-by-step installation details.

--dry-run
    Simulate reinstall without changes.

--ignore-dependencies
    Skip installing dependencies.

--only-dependencies
    Reinstall only dependencies, not the formula.

--build-from-source
    Compile from source, ignoring bottles.

--formula, --formulae
    Treat arguments as formulae (not casks).

--s
    Treat args as formulae/taps even if directories.

DESCRIPTION

The brew reinstall command in Homebrew (available on Linux via Linuxbrew/Homebrew-on-Linux) reinstalls specified formulae by first uninstalling them and then installing afresh. This is ideal for fixing corrupted installations, resolving dependency issues, or resetting packages without affecting dependents unless forced.

By default, it aborts if other installed formulae depend on the target, preventing breakage. Use options like --force to bypass this. On Linux, Homebrew operates in a user-owned prefix (e.g., $HOME/.linuxbrew or /home/linuxbrew/.linuxbrew), avoiding sudo. It fetches from bottles (pre-built binaries) when possible for speed, falling back to source builds.

Common use cases include troubleshooting broken kegs or updating specific packages post-upgrade failures. It preserves casks (GUI apps) unless specified otherwise. Always run brew update first for latest formulae. Note: Linux support requires compatible glibc and may need additional setup for dependencies like patchelf.

CAVEATS

Refuses reinstall by default if dependents exist; use --force cautiously to avoid breakage. On Linux, ensure glibc compatibility and set PATH correctly. Does not handle casks by default.

EXAMPLES

brew reinstall wget — Reinstall wget if no dependents.
brew reinstall --force git — Force reinstall git.
brew reinstall --build-from-source openssl@1.1 — Build from source.

LINUX NOTES

Install via /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". Prefix often $HOMEBREW_PREFIX; run brew doctor post-install.

HISTORY

Introduced in early Homebrew (pre-2010) for macOS; Linux support via Linuxbrew (2013, ~jhale), merged into Homebrew core (2020). Evolved with bottle support and dependency safeguards.

SEE ALSO

Copied to clipboard