Homebrew Updates on Autopilot: How to Automatically Update All Packages

Homebrew Updates on Autopilot: How to Automatically Update All Packages

Homebrew is the most popular package manager for macOS, making it easy to install and manage software. However, programs quickly become outdated – leading to security vulnerabilities, bugs, and performance issues.

Regular updates are essential to keep your system secure and efficient. Additionally, you always benefit from the latest features (except with Outlook, where each update seems to remove more features...). With Homebrew, you can update all packages with a single command while freeing up storage space. This saves time and ensures a lean, stable system.

Homebrew Packages:
Why Regular Updates Are Essential

To make updating your Homebrew packages even easier, we have prepared a handy command. This can be added as a alias to your shell configuration file, allowing you to update all packages and clean up the system with a single short command in the future.

The file where you add the alias depends on the shell you are using. If you are using Zsh (which is the default on modern macOS versions), the configuration file is located at: 

open -a textedit ~/.zshrc

Add the following command and restart your terminal session. After that, you can automatically install all packages – and free up storage – with a single command.

alias forceupdate='brew update && brew upgrade && brew install --cask --force `brew list --cask` && brew cleanup -s && brew cleanup --prune 0 && rm -rf "$(brew --cache)"'

You can also reload the environment configuration using the following command:

source ~/.zshrc