This two launchdaemon scripts provide scheduled updates and upgrade for homebrew packages.
It will run in the following way:
brew update
every day at 12:10brew upgrade
every 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
providing 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:wheel
by runningchown root:wheel /Library/LaunchDaemons/*.plist
- Load both plist files using
launchctl load
providing absolute path to the plist file