What This Script Does
The setup-hybrid-notifications.sh script creates a macOS LaunchAgent that automatically triggers the hybrid auto-update script on a recurring schedule. This is the companion scheduling script for auto-update-brew-hybrid.sh, and it is the recommended way to set up fully automated Homebrew maintenance with comprehensive notification support. Once configured, your Mac will keep all Homebrew packages up to date in the background and notify you via both email and text message whenever updates are applied.
This script works identically to the basic scheduling script (setup-auto-update.sh) in terms of its scheduling mechanism. The only difference is which auto-update script it targets. Where the basic scheduler points to auto-update-brew.sh (text-only notifications), this scheduler points to auto-update-brew-hybrid.sh (email and text notifications). Everything else — the interactive schedule selection, the plist generation, the launchd registration — follows the same process.
When you run the script, it guides you through selecting your preferred update schedule. You choose the frequency (daily, weekly, or on a specific day) and the time of day. The script then generates a launchd plist file that encodes your schedule preferences in the XML format that macOS expects. The plist is written to ~/Library/LaunchAgents/ and loaded into launchd, which activates the schedule immediately.
The LaunchAgent uses a different identifier than the basic scheduling agent, which means you can run both side by side if you want. However, this is not recommended — running two separate auto-update agents would mean your packages get updated twice as often, which is unnecessary and doubles the notification volume. If you are switching from the basic scheduler to the hybrid scheduler, the recommended approach is to first unload the basic agent, then set up the hybrid agent. The script's documentation explains how to do this.
Like all launchd agents, the scheduled task created by this script persists across restarts and login sessions. It runs under your user account and does not require administrator privileges. If your Mac is asleep or off when the scheduled update time arrives, launchd will run the update the next time your Mac wakes up or boots, ensuring no scheduled runs are permanently missed. The plist configuration includes the StartCalendarInterval key, which is the launchd equivalent of a cron schedule expression.
Before running this script, make sure you have configured both your email address and phone number in the Brew Scripts configuration file. The hybrid auto-update script uses both of these settings for its dual notification system. If either is missing, the corresponding notification channel will be silently skipped during each update run, which partially defeats the purpose of using the hybrid variant. You should also verify that your Mail.app has at least one active email account configured, since the email notifications are sent through Mail.app's AppleScript interface.
If you later decide you want to change the schedule, simply run this script again. It detects the existing plist, unloads the current agent, generates a fresh plist with your new preferences, and reloads it. You do not need to manually edit XML files or remember arcane launchctl commands. To stop scheduled updates entirely, you can unload the agent with a single terminal command, and to resume you simply load it again.