What This Script Does
The auto-update-brew-hybrid.sh script is the most fully-featured auto-update option in the Brew Scripts toolkit. It performs the same core Homebrew maintenance operations as the basic auto-update script — updating the package index, upgrading installed packages, and cleaning up old versions — but adds a comprehensive dual-notification system that keeps you informed through both email and text message.
The hybrid approach to notifications addresses a common trade-off. Text messages are great for quick, at-a-glance status updates that you can read in seconds, but they are not ideal for detailed information. Email, on the other hand, can accommodate a full report with all the technical details you might want to review, but emails are easy to miss or ignore if you are not checking your inbox regularly. By sending both, this script ensures you get the quick notification via text and the detailed report via email, covering both use cases.
The email report is the more substantial of the two notifications. It includes a complete list of every package that was updated, with both the old and new version numbers. If any packages failed to update, the error messages are included so you can diagnose the issue. The report also shows the total number of packages on your system, how many were outdated before the update, how many were successfully upgraded, and how much disk space was recovered during the cleanup phase. This level of detail makes it easy to audit your system's update history over time.
The text message notification is deliberately brief. It provides a one-line summary with the total number of packages updated and a pass/fail status indicator. If there were any errors, the text mentions that details are available in the email. This design means you can glance at the text on your phone's lock screen and immediately know whether everything went smoothly, without needing to read through a full report unless you want to.
Email delivery uses the macOS built-in Mail app via AppleScript. This means you do not need to configure an SMTP server, install any third-party email tools, or manage API keys for an email service. The script simply tells Mail.app to compose and send a message to your configured email address. The only prerequisite is that Mail.app is set up with at least one email account, which is the case for most Mac users. Text message delivery uses the same iMessage integration as the basic auto-update script, communicating with the Messages app through AppleScript.
Like all auto-update scripts in the toolkit, the hybrid version performs pre-flight checks before running. It verifies that your Mac is connected to the correct Wi-Fi network and optionally checks that AC power is connected. If either condition is not met, the script exits gracefully and logs the reason for skipping. This prevents unwanted updates from running on metered connections or draining your battery during a portable work session.
The script produces detailed logs that complement the email and text notifications. Even if both notification channels fail for some reason, the log file at ~/Library/Logs/ captures every detail of the update run. Each log entry includes a timestamp and severity level, making it straightforward to trace through the sequence of events and identify where any problems occurred.