New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TN not working from launchd #259
Comments
I had installed terminal-notifier using brew, according to https://superuser.com/questions/734563/terminal-notifier-fails-silently-when-called-from-launchd I have to run terminal-notifier from the app bundle, so I did an alias of /usr/local/Cellar/terminal-notifier/2.0.0/terminal-notifier.app in in /Applications folder, it doesn't work better, I tried an ln -s but that neither does it run (it says too manu symlinks). |
The solution in #148 by @applebit924 seems a bit cryptic to me. I understand he's notifications are not fired by his main script but by a script fired by a watchdog. The watchdog runs from /Library/LaunchAgents and not from /Library/LaunchDaemons, but for the rest I don't see terminal-notifier in there unless he renamed it "Software Update Notifications" and I don't understand why he's building a notification script each time he needs to show a notification. Seems very complicated. |
launchdaemons run as root. I would not expect root to be able to post an NSUserNotification. |
This works for me. Use 'open' command. |
@Vartkat A GUI can't be launched by a daemon in macOS. |
Please check everything that applies to your issue:
To help us debug your issue please include:
10.10
2.0
Homebrew
Make a simple bash script which fires terminal-notifier (in /usr/local/sbin), make a launchd plist file calling this script with
in /Library/LaunchDaemons
(note - StartInterval with a value of 3600 fires the script every hour)
To run the script load the plist
$ sudo launchctl load PLIST_FILE
To stop it unload the plist file.
Using terminal-notifier the whole script gets stuck as if it was asleep (no error).
I had to kill terminal-notifier so that the bash script resume (terminal-notifier was a sub-process of the script).
I also tried replacing TN with osascript display notification but that doesn't show anything on the user screen.
I thought it was because launchd launched processes are running as root but with UserName it should run as the named user.
Notting suspicious show up in the Console.
The text was updated successfully, but these errors were encountered: