The brew upgrade command is a useful tool for updating and upgrading packages on your macOS system. However, remembering to run this command manually every day can be a hassle. Fortunately, there are two different ways to automate this process so that the command runs automatically at the same time every day.
Method 1: Using cron
The first method involves using cron, a Unix-based scheduling tool that is included with macOS. Here’s how to set up a cron job to run the brew upgrade command every day:
- Open Terminal on your Mac. You can find Terminal in the Utilities folder within the Applications folder.
- Type
crontab -eand hit enter to open the crontab editor. - If this is your first time using cron, you may be prompted to choose a text editor. Select your preferred text editor (e.g. nano, vim, emacs).
- In the crontab editor, add the following line to schedule the
brew upgradecommand to run every day at 8am: