Disable Notifcations via Script. Equivalent to option clicking notifications.


Looking for a way to disable notifications, either by a script equivalent to option clicking or using DND from 7am to 2am, something like that?



Legendary Contributor III

Hmm, not sure if there's a way to turn off Notifications on a global level or not in a script. Maybe.
You could also look at @jacob_salmela's NCutil utility, which allows you to set alert styles for individual apps. Not sure if that's sufficient for what you're looking for though. Maybe he or someone else knows of a single command that will turn off all Notifications.

Legendary Contributor III
launchctl unload /System/Library/LaunchAgents/com.apple.notificationcenterui.plist

The above turns off Notification Center, as in, disables it completely so it doesn't show notices and the small Notification UI icon in the menubar does nothing when its clicked. (It remains in the menu, but is effectively neutered) Only thing is, since its a LaunchAgent, it needs to be run as the logged in user. Don't be fooled by the fact that the launchd plist resides in /System/Library/ It can and must be run as a user to disable it, not root.

In my experiementing, to re-enable it you need to run, again, as the user:

launchctl load /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall SystemUIServer

If I don't restart the menubar (SystemUIServer) it doesn't really reload the Notification Center menu item.

To be very clear, the above is a hacky kludge, no mistake about it, and I'm sure Apple would highly disapprove, so hopefully there's a more accepted way of turning this stuff off.


I will most definitely experiment with this launchd that, as you say, neuters it! Thanks!


I tried that and it most definitely works, but after thinking about it more, I'm not sure I want the whole notifications to be disabled (neutered).

My main goal is to NOT have any of the annoying system update, firefox updates, etc.. sliding in from the right side of the screen.

DND would be perfect. Some other admins spoke about using it as a custom setting in Profiles, but I was unable to get that to work on any machine other than the one it was created on (ByHost naming). When I removed that part of the ByHost file name it wouldn't work at all.

Unloading the launchd for Notifications isn't the same as DND or option clicking.

Any other thoughts?


Legendary Contributor III

OK, so you want to just silence any notification pop ups, but still allow users to manually go into NC and see any messages that have come through. That right?

I did a little more digging and found that the plist that gets written to when DND mode is enabled is


it looks like this when DND is on/enabled

    doNotDisturb = 1;
    doNotDisturbDate = "2016-04-29 17:27:20 +0000";

The doNotDisturb key is boolean, so in the above case its set to true. The date key is the date it was set into DND mode as far as I can tell.

It might be possible to create a custom user level Configuration Profile that would apply this change. The only problem is I believe it resets out of DND after 24 hours, if I recall correctly. So a Config Profile may not be able to keep it permanently in that state.
Maybe you can have an ongoing policy that runs a script to set the two keys to the values they need to be to keep it off.


Yes, that is the same files I was using to import into Profile Manger, but now would probably use with JSS (we just got JAMF).

Apparently this used to work before El Capitan. They sure like to keep us working on work-arounds! haha

To save time though, since this is for labs and users don't have iCloud settings and such anyway, maybe I will just use the unload!

Contributor II

@kutzboy NCuti.py cannot set it globally for all users; it's still a feature I am working on implementing. I had a few ideas for doing this via some bash-fu but it hasn't been very effective.

New Contributor III

Does anyone know a method that does not require turning off SIP?

Contributor III

@jacob_salmela Does NCutil utility work in Sierra?

Contributor II

@myronjoffe not without disabling SIP...

Contributor III

I run this as part of a script on all shared Macs (labs, loaners, etc.) to disable Notification Center:

MAC_UUID=$(system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}')

# Setup DND on NotificationCenter
 for USER_TEMPLATE in "/System/Library/User Template"/*
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "dndEnd" -float 1379
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "doNotDisturb" -bool FALSE
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "dndStart" -float 1380

Probably stole that from...somewhere. Can't remember where or I'd give proper credit.

Works for all accounts created thereafter. Should be possible to extend that to already existing accounts.


@barnesaw thank you that got rid of the "Welcome to macOS Mojave" notifications I was trying to squash and also sped up login times by 20 to 30 seconds. It was pretty incredible.