Skip to content

Daily brew with launchd

Posted on:November 9, 2015

It’s a good idea to run brew every day.

Instead of cron, I use launchd instead. launchd has better integration with system behavior, such as running scripts on system wake. (Admittedly, the XML syntax is quite horrid, but we’ll live with it.)

Create a local.custom.brew.plist file in ~/Library/LaunchAgents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

This will run brew update, brew upgrade, brew cleanup, and brew doctor at midnight every day.

Load the .plist file

To load the .plist file, there are two options available:


$ launchctl load ~/Library/LaunchAgents/local.custom.brew.plist
$ launchctl start local.custom.brew


lunchy is a wrapper around launchctl:

$ gem install launchctl
$ lunchy restart local.custom.brew