julienXX / terminal-notifier

Send User Notifications on macOS from the command-line.
Other
6.36k stars 331 forks source link

`terminal-notifier` errors on macOS Big Sur #280

Closed goranmoomin closed 4 years ago

goranmoomin commented 4 years ago

Please check everything that applies to your issue:

To help us debug your issue please include:

Execute terminal-notifier in shell, and see it error.

$ terminal-notifier   
2020-07-03 19:08:03.964 terminal-notifier[23544:757939] [!] Unable to post a notification for the current user (josungbin), as it has no running NotificationCenter instance.

I'm more than happy to help debugging this issue as I have macOS Big Sur installed on my main machine.

strafe commented 4 years ago

Same here.

julienXX commented 4 years ago

I need to look at the updated doc for NotificationCenter. Thanks for the offer I’ll ask you if I need testing as I don’t install beta-OSes on my machine.

JayBrown commented 4 years ago

UI seems to be different, too… found this on the web.

notification

goranmoomin commented 4 years ago

@JayBrown Yes, it is. The UI is rewritten in SwiftUI, and I’m guessing that the notification subsystem itself also got rewritten?

fromdavelewis commented 4 years ago

It's just that the Notification Center bundle identifier has changed (to "com.apple.notificationcenterui2" :) ). Let me see if I can get a clean PR with a reasonable conditional. It works in BigSur if I just change that value but obviously that's not ok on its own. You do still need to allow terminal-notifier to make notifications of course but that's easy clicking and you're prompted to do so.

fromdavelewis commented 4 years ago

https://github.com/julienXX/terminal-notifier/pull/281 🤞 :)

fromdavelewis commented 4 years ago

There may be a further Big Sur issue with running this via symlink -- if I don't run this directly from the built binary, it hangs :(

JayBrown commented 4 years ago

That's a problem with many apps, whose executables have command-line support on paper. The best thing would be to export the bundle's executable directory in $PATH.

export PATH=$PATH:/Applications/terminal-notifier.app/Contents/MacOS

In shell scripts I always use mdfind to search for the terminal-notifier Bundle ID, giving me variable $tn_loc, and then execute terminal-notifier as "$tn_loc"/Contents/MacOS/terminal-notifier. If there's no terminal-notifier on the system, I revert to osascript for notifications.

EDIT: but a developer can make it happen… for example ProcessMonitor by @objective-see runs fine when symlinked.

fromdavelewis commented 4 years ago

Note that in Big Sur Beta 3 the Notification Center bundle identifier has changed back to "com.apple.notificationcenterui", so functionally should be restored to everyone.

goranmoomin commented 4 years ago

I'm guessing this can be closed.

jcguu95 commented 2 years ago

Hmm I'm on macOS 12.5 and this happens again.

Error

2022-07-28 11:36:23.394 terminal-notifier[77241:604046] [!] Unable to post a notification for the current user (jin), as it has no running NotificationCenter instance.

Info:

$ defaults domains | grep notification
com.apple.notificationcenterui
$ defaults read com.apple.notificationcenterui
{
    "last-analytics-stamp" = "680547569.399271";
    widgets =     {
        vers = 1;
        widgets =         (
            {length = 4018, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00000f78 },
            {length = 9808, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002616 },
            {length = 920, bytes = 0x62706c69 73743030 d5010203 04050607 ... 00000000 00000362 },
            {length = 16416, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00003fe6 },
            {length = 16409, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00003fdf },
            {length = 9129, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 0000236f },
            {length = 9842, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002638 },
            {length = 918, bytes = 0x62706c69 73743030 d5010203 04050607 ... 00000000 00000360 },
            {length = 9825, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002627 },
            {length = 83230, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 000144ca },
            {length = 7780, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00001e2a },
            {length = 4581, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 000011ab },
            {length = 990, bytes = 0x62706c69 73743030 d5010203 04050607 ... 00000000 000003a8 },
            {length = 12276, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002fba },
            {length = 960, bytes = 0x62706c69 73743030 d5010203 04050607 ... 00000000 0000038a },
            {length = 8304, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002036 },
            {length = 8611, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002169 },
            {length = 8275, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002019 },
            {length = 9594, bytes = 0x62706c69 73743030 d6010203 04050607 ... 00000000 00002540 }
        );
    };
}