The launchd scripts below follow the Mac OS X way to run scripts that automatically update and upgrade brew and pip packages on a set schedule.
They will run daily as follows:
- Homebrew (brew) Update at 3:01AM, upgrade at 3:03AM, and cleanup at 3:09AM
- Python packages (via pip) Upgrade at 3:15AM
Logs will be stored in /private/tmp
These scripts will only run when you (the user) are logged in
- Copy (download then move) each plist file to
~/Library/LaunchAgents/
- Load each plist file one at a time via
launchctl load filename
wherefilename
is name of the plist file (you can also just load them all vialaunchctl load com.example.*
)
# update brew pkgs:
1 3 * * * /usr/local/bin/brew update
3 3 * * * /usr/local/bin/brew upgrade
9 3 * * * /usr/local/bin/brew cleanup
# update python pkgs:
15 3 * * * /usr/local/bin/pip-review --auto
# update node pkgs:
20 3 * * * /usr/local/bin/npm update -g
25 3 * * * /usr/local/bin/npm prune -g