During 2020 the sub-commands of the command were gradually integrated into the core of Homebrew and were deprecated. The core commands now operate on both formulae and casks. To limit their scope to only formulae or casks add the cask or --formula option to the command line.--cask
The command has been completely removed from Homebrew in version cask, released in December 2020.2.6.0
There is a unified flow now for both formulae and casks:
brew update
brew outdated
brew upgrade
The first command () gets from the Homebrew servers the information about the most recent versions of the available formulae and casks.brew update
The second command () lists the outdated installed formulae and casks. Add brew outdated or --formulae to the command line to limit the command scope to formulae or casks. Add --casks to the command line to include in its output the casks that are marked as "auto-updateable".--greedy
The third command () upgrades the packages listed by brew upgrade. It also supports the options listed above for brew outdated and operates accordingly.brew outdated
The original answer and the 2018 update are kept for historical reasons.
In the meantime, the command has been implemented and can be used instead of brew cask upgrade in the script provided in the original answer.brew cask reinstall
It also works without arguments and upgrades all the casks displayed by . It can replace the brew cask outdated block in the script that now becomes:for
# Upgrade Homebrew and the information about formulas
$ brew update
# List the outdated casks (optional)
$ brew cask outdated
# Upgrade all outdated casks
$ brew cask upgrade
Sometimes, does not list all the outdated casks. This is by design. Some casks mark themselves as auto-updateable while others use the keyword brew cask outdated as their version. These two categories of casks are not listed by latest. To list them one have to add the brew cask outdated option in the command line of --greedy:brew cask outdated
$ brew cask outdated --greedy
This command includes in its output the casks mentioned above. Those having as their version cannot be checked and are always listed, those marked as auto-updateable are checked and listed only if they are outdated indeed.latest
The command also accepts the brew cask upgrade option (internally it uses --greedy to find the list of packages to upgrade). Using it ensures your system is up to date with the additional cost of reinstalling some applications that are not outdated.brew cask outdated
You are mixing commands with brew commands and it doesn't work this way.brew cask
Homebrew Cask is a component of Homebrew that allows management of graphical applications. It started as an extension of the original Homebrew; it is now an integrated command of . The Homebrew itself manages only command line applications.brew
Upgrading all outdated programs installed with (command line programs) is easy:brew
# Tell Homebrew to update itself and its taps (repositories of programs)
$ brew update
# List the outdated programs
$ brew outdated
# Upgrade all the outdated programs and their dependencies
$ brew upgrade
The and brew update steps are optional. brew outdated internally calls brew upgrade if the last update happened too much time in the past. brew update only lists the outdated installed programs; it is useful if you do the upgrade manually and you don't want to upgrade everything. In this case you can pick the programs you want to upgrade and run brew outdated for each program you want to update. Replace brew upgrade <program> with the package name displayed by <program>.brew outdated
Upgrading all outdated graphical programs is not that straightforward at the moment. The process is slightly different than the above.
The first step is to run . It updates Homebrew code and the taps (a tap is a repository of programs managed by Homebrew). Homebrew Cask provides the sub-command brew update but it is just an alias of brew cask update. You can use any of them; brew update is preferred because it is shorter.brew update
The second step is to run . This command shows the list of outdated programs managed by Cask, together with the installed version and the new version. The option brew cask outdated tells it to show only the package names, without versions. You'll need this for automation on the third step.--quiet
The next paragraphs are deprecated since 2018, when the command has been implemented. The new flow is described in the section "2018 update" above.brew cask upgrade
Unfortunately there is no
command at this moment (it is planned but not implemented yet).brew cask upgradedoesn't know how to handle the programs installed bybrew upgradeeither.brew cask
can be used instead of the missingbrew cask reinstall. Unlikebrew cask upgrade, that upgrades all the outdated packages,brew upgraderequires the name of one and only one package. This requires looping through the list returned bybrew cask reinstall.brew cask outdatedA short shell script that upgrades all outdated programs installed using Homebrew Cask can look like this:
brew update for i in $(brew cask outdated --quiet); do brew cask reinstall $i doneDrawbacks
There are programs that require administrator rights to install drivers or other system components. Some of them ask for your password or for various confirmations using a graphical dialog box.
itself sometimes asks for your password in the command line.brew caskAll these make upgrading the outdated programs automatically not always possible.
You may think that all these can be circumvented using
. However, the Homebrew developers know better and they programed thesudocommand to display a message and exit when it is executed as root (and this is the right way to do it.)brew
Just prefix your install command with , like this:HOMEBREW_NO_AUTO_UPDATE=1
HOMEBREW_NO_AUTO_UPDATE=1 brew install somepackage
Source: brew manpage