A shell script to automatically update `brew` using `launchd`

Following a conversation on the Brew forums, I’ve posted my shell script and launchd plist which can be used to keep brew up to date:

The purpose is that when you go to update / install something with brew it will go through the update process first, which can take awhile if you have not run it recently.

My script runs it every 2 days (which you can easily change) and it runs in the background, so you should never even notice it is running.

OTOH, If you have growlnotify or terminal-notifier installed, it will use those to inform you of what it is doing, but even that can be disabled if you prefer.

Let me know if you have any questions or problems getting it to work.


Great job @tjluoma Using it now!

I need to look into setting this up. I found your post on the forum and I have the same issue as the person you helped. Use it only about once a month and its annoying to wait to install a simple CLI program or a cask (that’s honestly my biggest use).

See also topgrade which when run with -c will clean up everything afterwards. (Caches, old versions and so on)

I’m not familiar with topgrade (although it looks useful!) but brew does have its own ‘cleanup’ command, which is part of my setup / script. Not sure if topgrade would be needed in this case, but still might check it out for other things.

Yeah, topgrade uses brew. It upgrades tons of stuff.