A script and launchd agent for automatically installing Homebrew updates, on macOS.
This tool is built for my preferences, but maybe it's flexible enough to be useful for other people too.
- Provides wrapper script for doing a full homebrew upgrade
- Updates Homebrew
- Checks for outdated formulae
- Runs the upgrade
- Cleans up afterward
- Provides launchd agent and installer to let launchd run upgrades automatically
- Allows for "blocker formulae" that stop autoupgrades, in case you have formulae you want to manage on your own timeline
- Runs upgrade in Terminal.app so you can see all output
- Shows every
brew
command that's run in the script, to demystify things - Keeps your computer awake while running upgrade
- Clone this repo somewhere on your machine
git clone [email protected]:rosston/brew-autoupdate.git cd brew-autoupdate
- Install the launchd agent
./brew-autoupdate install
- If you want to stop autoupdate from running when certain formula are
available for upgrade (e.g., you often detach from tmux sessions with vim
running in them and don't want tmux or vim updated out from underneath you),
you can add a "blocker formulae" list
mkdir -p ~/.config/brew-autoupdate touch ~/.config/brew-autoupdate/blocker-formulae # Then put whatever formulae names you want in this file, # one formula per line.
- If you want to run the full update process manually, do
./brew-autoupdate run
- If you don't like when the autoupdate happens, you can edit the installed
plist file at
~/Library/LaunchAgents/com.thinkingsauce.brew_autoupdate.plist
and change the interval settings (HINT: runman launchd.plist
and search forStartCalendarInterval
to see your options)
NOTE: I think you need to have your screen on for the first time the launchd agent runs so that you can approve a prompt to let "sh control Terminal". That's because the plist uses some AppleScript to run the autoupdate script in Terminal.app.
- Run the uninstall script
# Wherever your brew-autoupdate repo is cloned ./brew-autoupdate uninstall
- Delete the repo
- If you want to clean up everything, remove the blocker-formulae file
(which may or may not exist, depending on how you set things up)
rm -f ~/.config/brew-autoupdate/blocker-formulae