This two launchdaemon scripts provide scheduled updates and upgrade for homebrew packages.
It will run in the following way:
brew updateevery day at 12:10brew upgradeevery day at 12:20
Create directory to store logs:
$ sudo mkdir -p /var/log/homebrew
There are two options for running those scripts.
This will run tasks only when user is logged in.
- Put both files to
~/Library/LaunchAgents/ - Load both plist files using
launchctl loadproviding absolute path to the plist file
This way it is possible to run updates regardless of any user active login session. This method, however requires admin privileges, thus run commands below with sudo.
- Put both files to
/Library/LaunchDaemons/ - Fix permissions
chmod 644 /Library/LaunchDaemons/*.plist - Make sure that owner is
root:wheelby runningchown root:wheel /Library/LaunchDaemons/*.plist - Load both plist files using
launchctl loadproviding absolute path to the plist file