brew-reinstall
Reinstall Homebrew packages
TLDR
Reinstall a formula/cask
Reinstall a formula/cask and show verification and post-install steps
Make some output more quiet
Display help
SYNOPSIS
brew reinstall [options] <formula|cask>...
PARAMETERS
<formula|cask>
The name of the Homebrew formula (e.g., git) or cask (e.g., google-chrome) to reinstall. Multiple formulas/casks can be specified separated by spaces.
--build-from-source, --formula
Reinstall the formula by compiling it from source instead of using a pre-built binary package (bottle). This is useful for custom build flags or specific environment configurations.
--cask
Explicitly treat the argument as a cask. This is often inferred by Homebrew but can be useful for clarity or when ambiguity exists between a formula and a cask with the same name.
--force-bottle
Install from a bottle (pre-built binary) if possible, even if the formula was previously installed from source or if a bottle might otherwise be skipped due to certain conditions.
--ignore-dependencies
Do not install or reinstall any dependencies required by the specified formula or cask. Use with caution, as it can lead to broken functionality if required dependencies are missing or outdated.
--skip-post-install
Skip the post-install steps for the formula or cask, which might include linking, setting up services, or running specific configuration scripts.
--debug
Display debug logs, providing more detailed output that can be helpful for troubleshooting issues during the reinstall process itself.
-v, --verbose
Make the output more verbose, showing additional information about the steps Homebrew is taking during the reinstall operation.
--dry-run
Show what would be reinstalled without actually performing the reinstall. This is useful for planning or checking dependencies before making changes.
--overwrite
Overwrite existing files during the linking phase (e.g., in /usr/local/bin) instead of refusing to link. This is an advanced option and may cause breakage if not used carefully.
DESCRIPTION
The brew reinstall command in Homebrew, the package manager for macOS and Linux, allows users to uninstall and then immediately reinstall specified formulas or casks. This is a crucial utility for troubleshooting issues like corrupted installations, linking problems, or when an installed package is not functioning as expected. Unlike brew install, which skips installation if a package is already present, reinstall explicitly removes and then adds the software again, ensuring a fresh installation of the current version. It's often used when an upgrade isn't sufficient, to revert to a clean state, or to apply changes that require a complete reinstallation.
CAVEATS
This command relies on Homebrew being installed and configured correctly on macOS or Linux. Reinstalling a formula from source can be time-consuming and resource-intensive, especially for large packages. While generally safe, using options like --ignore-dependencies or --overwrite without a clear understanding of their implications can lead to broken installations or system instability. brew reinstall primarily refreshes the package itself and may not resolve issues stemming from external system configurations, permissions, or conflicts with non-Homebrew managed software.
WHEN TO USE <B>BREW REINSTALL</B>
Use this command when a package's installation appears corrupted, its symlinks are broken, or if you suspect an issue with its files. It's also useful after manually tampering with installed files, or if a package isn't behaving as expected after an update or system change. Unlike brew install, it guarantees a fresh copy even if the package is already present.
HOW IT WORKS
Essentially, brew reinstall performs a sequence of operations: first, it executes a brew uninstall for the specified formula or cask, removing its existing files and links. Immediately after, it performs a brew install, ensuring that all necessary dependencies are met and a new, clean installation of the package is performed. This process ensures a fresh state, resolving many common installation-related problems.
HISTORY
Homebrew, created by Max Howell in 2009, rapidly evolved into the primary package manager for macOS, and later expanded its support to Linux (as Linuxbrew, now integrated). The reinstall command has been a fundamental component of Homebrew's utility suite since its early development, providing users with a robust and straightforward method to manage, repair, and refresh their software installations. Its design reflects Homebrew's core philosophy of providing simple, powerful command-line tools for package management.
SEE ALSO
brew(1), brew-install(1), brew-uninstall(1), brew-upgrade(1), brew-list(1), brew-cleanup(1)


