brew-upgrade
Upgrade outdated Homebrew packages
TLDR
Upgrade all outdated casks and formulae
Upgrade a specific formula/cask
Print what would be upgraded, but don't actually upgrade anything
SYNOPSIS
brew upgrade [options] [formula|cask ...]
Note: When no formula or cask is specified, all outdated packages are upgraded.
PARAMETERS
--formula, -f
Upgrade only formulae, not casks. This option helps to narrow down the scope of the upgrade.
--cask, -c
Upgrade only casks, not formulae. Useful for managing graphical applications separately.
--cleanup
After the upgrade, automatically remove old versions of formulae and their obsolete dependencies. This helps to free up disk space.
--dry-run
Perform a simulated upgrade. It shows which packages would be upgraded without actually making any changes, useful for planning.
--force
Force a reinstallation of the formula or cask, even if it's already installed and up-to-date. Can be used to fix broken installations.
--greedy
Upgrade auto_updates casks even if they are not explicitly marked as outdated by Homebrew. This is for casks that manage their own updates.
--verbose, -v
Display more detailed output during the upgrade process, including download progress and compilation steps.
--debug, -d
Display debug information, useful for troubleshooting issues with the upgrade process.
--json
Print upgrade information in JSON format, which can be useful for scripting and programmatic access.
DESCRIPTION
The brew upgrade command is a core component of Homebrew, the popular package manager for macOS and Linux. It is used to update all or specified installed packages (formulae and casks) to their latest available versions.
When executed without any arguments, it checks for newer versions of all currently installed software and downloads and installs them. If specific formulae or casks are provided as arguments, only those particular applications will be upgraded. brew upgrade handles dependencies automatically, ensuring that all necessary libraries and components are also updated or installed.
This command is crucial for maintaining a system with up-to-date software, patching security vulnerabilities, and accessing new features. It works by first running brew update implicitly to fetch the latest package definitions before performing the upgrade.
CAVEATS
Time and Network Usage: Upgrading all packages, especially after a long time, can take a significant amount of time and consume considerable network bandwidth due to large downloads.
Breaking Changes: New versions of software might introduce breaking changes that could affect existing configurations or workflows. It's advisable to check release notes for critical applications.
Disk Space: While brew upgrade can clean up old versions with --cleanup, repeated upgrades without cleanup can consume significant disk space.
Dependency Issues: Although Homebrew generally handles dependencies well, rare conflicts or issues can occur, especially with complex setups or older macOS versions.
Implicit brew update: brew upgrade automatically runs brew update first, which might cause delays if the Homebrew tap cache is large or internet is slow.
IMPLICIT <B>BREW UPDATE</B> BEHAVIOR
The brew upgrade command automatically performs a brew update operation before checking for and installing upgrades. This ensures that Homebrew's local package definitions (taps) are current, guaranteeing that it identifies the very latest available versions of software. This implicit update can sometimes add to the total execution time of brew upgrade.
BEST PRACTICE FOR REGULAR MAINTENANCE
It is a common best practice to run brew update && brew upgrade && brew cleanup regularly. This sequence ensures that your Homebrew installation itself is updated, all your installed software is upgraded to the latest versions, and then old, unused files are removed, freeing up disk space.
HISTORY
The brew upgrade command has been a fundamental part of Homebrew since its early days. Homebrew, created by Max Howell in 2009, was designed to simplify software installation on macOS (and later Linux via Linuxbrew/Homebrew for Linux). The upgrade command was essential from the outset to fulfill the basic need of keeping installed software up-to-date, mirroring similar functionality found in other package managers like apt upgrade or yum update. Its functionality has evolved with Homebrew, gaining options like --cleanup and --greedy to provide more control and better resource management, reflecting the growing complexity and user base of the package manager.
SEE ALSO
brew update(Fetches the latest versions of Homebrew and all formulae and casks.), brew install(Installs a specified formula or cask.), brew outdated(Lists all installed formulae and casks that have newer versions available.), brew cleanup(Removes old versions of formulae and their dependencies from the Homebrew Cellar.), brew list(Lists all installed formulae and casks.)