I've created a script to update my package manager and post a notification via terminal-notifier. When run manually, it works fine, but when called via launchd (local to the user, in ~/Library/LaunchAgents/), terminal-notifier seemingly doesn't start. It doesn't hang, however; later parts of the script run as expected. Nothing is produced on stdout/stderr. I'm using absolute paths in everything, so that's not the problem either in terms of manual vs. launchd execution. I'm fairly sure this is just another stupid quirk of launchd, but is there any way to overcome it?
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.brew.autobrew</string> <key>ProgramArguments</key> <array> <string>/Users/[USERNAME]/.scripts/autobrew.sh</string> </array> <key>StartCalendarInterval</key> <dict> <key>Minute</key><integer>0</integer> <key>Hour</key><integer>22</integer> </dict> <key>AbandonProcessGroup</key> <true/> <key>StandardOutPath</key> <string>/tmp/autobrew_launchd.log</string> <key>StandardErrorPath</key> <string>/dev/autobrew_launchd.log</string> </dict> </plist>
The relevant line of code in autobrew.sh
/usr/local/bin/terminal-notifier -title "Homebrew updates" -sound default