I’m having trouble getting bash scripts to run for notifications, either by calling terminal-notifier (which is installed and working) or by other shell scripts. I’m running ToothFairy 2.6 on Mojave 10.14.6. I see the gear meaning the script is running, but no notifications show up and there’s nothing in Console.
This works:
#!/bin/sh
osascript -e 'display notification "Connected" with title "AirPods"'
It’s good that the osascript script for posting to Notification Center is working. Besides the terminal-notifier one, which other scripts are not working? Does that command for Terminal Notifier work if you run it directly from Terminal?
If the system reports an error when running the script, ToothFairy will log it to Console. The easiest way to find it is by entering a search for MJTLogger before the script will run.
terminal-notifier works if I call it directly from Terminal.
After turning on logging, here’s the error:
Error running script: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={
NSURL=file:///Users/[username]/Library/Application%20Scripts/com.robinlu.mac.Tooth-Fairy/1.connected,
NSLocalizedFailureReason=/Users/[username]/Library/Application Scripts/com.robinlu.mac.Tooth-Fairy/1.connected: line 2: terminal-notifier: command not found}
Glad you figured it out. That error should be visible even without turning on the debug logging. I guess somehow your $PATH was not correct in the environment that was running the script.