48

Today I'm dealing with the following problem:

Never Ending Eject Notifications

Is there some way I can get rid of these without spending my entire day clicking, short of Homer's Drinking Bird?

Note: This is not a duplicate of How do I clear All OS X notifications with 1 click?, because the notifications in my question aren't shown at all in the Notification Center, and thus the solution in that question doesn't work for this question.

3
  • 2
    I edited this question to explain how it's different from the one marked as a duplicate - the main distinction being that the linked solution doesn't actually work in this case. May 17, 2018 at 1:05
  • 1
    Did you work out what causes this? I have a new USB hub, with backup disk attached to it, and I'm getting this... Mar 22, 2020 at 20:06
  • 1
    This is still happening in 2024... I submitted a bug report for macOS Sonoma 14.2.1. I woke up to the new year with hundreds of those. If you disable the auto sleep for hard disks, you don't get those. But what if I want the internal hard disk to sleep? macOS was the one "ejecting" the external hard disk, not me... Thanks for the "killall NotificationCenter". It saved me hundreds of clicks!
    – endavid
    Jan 1 at 10:54

2 Answers 2

77

I started killing processes with "Notification" in their name, and when I hit the one called "NotificationCenter" the smoke finally cleared:

killall NotificationCenter
5
  • 10
    Ken, you made my weekend - I'm going to name a puppy after you! I might sound silly yelling "Ken Williams!" all over the park, but I'm good with that
    – Sean Chase
    Jun 30, 2018 at 3:30
  • 2
    FWIW, pkill NotificationCenter works pretty much the same way. And it seems good to restart the process afterwards--its at: /System/Library/CoreServices/NotificationCenter.app/Contents/MacOS/NotificationCenter & (There's probably a more sophisticated way to do this with a single restart signal.)
    – MarkHu
    Sep 7, 2018 at 17:33
  • 2
    @MarkHu: More gracefully: open /System/Library/CoreServices/NotificationCenter.app
    – Daniel
    Jun 15, 2020 at 7:21
  • 5
    maybe its the new OS update, but they come back a second later, like a bunch of zombies
    – Sonic Soul
    Nov 11, 2020 at 23:00
  • 1
    This is by far the best answer .. and the answer I was looking for. I had already tried "killall Dock" and "killall Finder", but those did not clear the notifications. I wish there was a cleaner way to do this, but this works, and currently does not leave zombie processes behind (at least in my experience).
    – jewettg
    Jul 18, 2022 at 14:01
7

The Apple Script from "software is fun", with 3 votes at the time of writing, in the suggested duplicate gets rid of all "Disk Not Ejected Properly" notifications on High Sierra (additionally you have to allow Script Editor to control the computer in Accessibility preferences as the post suggests):

tell application "System Events"
    tell process "NotificationCenter"
        set numwins to (count windows)
        repeat with i from numwins to 1 by -1
            click button "Close" of window i
        end repeat
    end tell
end tell
4
  • 1
    I have the same problem and am not familiar with utilizing scripts on my Mac. Can anyone walk me through this process. I can't keep pressing the close button its killing me.
    – user303817
    Sep 27, 2018 at 3:20
  • 1
    This works great with Keyboard Maestro. Have it run the script when a usb drive is disconnected.
    – majorgear
    Sep 29, 2020 at 2:28
  • 1
    @user303817 the linked question has a demonstration of how to run a script like this. Jul 19, 2022 at 14:40
  • yessss, I did this using hammerspoon instead of Keyboard Maestro. thanks!
    – Y. Gherbi
    Feb 26 at 2:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .