DEV Community

Faris Durrani
Faris Durrani

Posted on

Setting up auto brew update using crontab

On MacOS, brew is a package manager that helps install, manage, and update packages using the terminal, and crontab is a scheduler that runs commands at specific times at specific intervals.

You can use https://crontab.guru/ to help you create an interval of your own using the format:

[minute: 0-59] [hour: 0-23] [day: 1-31] [months: 1-12] [weekday: 0-6]
Enter fullscreen mode Exit fullscreen mode

For this example, you can set a crontab schedule to run brew update (to get info on the latest versions of packages) and brew upgrade (to actually install the latest versions) at 12:00 local time every Monday by adding the following line to your crontab -e entry.

0 12 * * 1 /opt/homebrew/bin/brew update && /opt/homebrew/bin/brew upgrade
Enter fullscreen mode Exit fullscreen mode

Safe harbor statement

The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.

This work is licensed under a Creative Commons Attribution 4.0 International License.

Top comments (0)