Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disable/Enable Notification Center (MacOS X)

Toggle MacOS X Notification Center on or off

This gist is to remind me (and anyone else who it helps) how to quickly disable and re-enable Notification Center.

Set Up Bash Aliases

Installation

  1. Open your terminal (<⌘ + ␣ (spacebar)>, then type "terminal", then press < (enter)>).

  2. Paste and run the following command:

echo >> ~/.profile && echo >> ~/.profile && echo '# Disable/enable notification center' >> ~/.profile && echo 'alias disableNotificationCenter="launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && killall NotificationCenter"' >> ~/.profile && echo 'alias enableNotificationCenter="launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist && open /System/Library/CoreServices/NotificationCenter.app/"' >> ~/.profile && source ~/.profile

Usage

To disable notification center:

disableNotificationCenter

To re-enable notification center:

enableNotificationCenter

How it works / background

Goal

Disable MacOS X's Notification Center entirely. But make it easy to turn it back on and disable again as needed.

Reasoning

I'm tired of seeing notifications that I can't dismiss, and there's no easy way to do this selectively (e.g. MacOS notifications always come through)

How this disables Notification Center

launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall NotificationCenter

How this re-enables Notification Center

launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
open /System/Library/CoreServices/NotificationCenter.app/

Bibliography

This approach is a command-line-only version of the solution proposed in a great article on osxdaily.com.

@gianpaj

This comment has been minimized.

Copy link

@gianpaj gianpaj commented Sep 28, 2015

Is the a way just to disable notification temporarily ie. turn on the 'Do not Disturb' switch? ie. for 15 mins?

screenshot_28_09_2015_14_47

@ozdv

This comment has been minimized.

Copy link

@ozdv ozdv commented Feb 13, 2018

No longer works with macOS Sierra 10.12

@xbeta

This comment has been minimized.

Copy link

@xbeta xbeta commented Mar 11, 2018

+1 tested in macOS High Sierra, also do not work anymore :-(

@jd20

This comment has been minimized.

Copy link

@jd20 jd20 commented Jun 22, 2018

It's because notification center is now protected by SIP. Since Apple doesn't seem to provide a master kill switch, a cleaner solution (although more work) is to just disable the notification settings for each app, one by one.

@ifernandolopez

This comment has been minimized.

Copy link

@ifernandolopez ifernandolopez commented Aug 16, 2018

In High Sierra, first we have to disable System Integrity Protection:

https://www.howtogeek.com/230424/how-to-disable-system-integrity-protection-on-a-mac-and-why-you-shouldnt/.

Then we can disable the launch agent:

launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
killall NotificationCenter

@tkimpton

This comment has been minimized.

Copy link

@tkimpton tkimpton commented Aug 31, 2018

It is never a good idea to disable the security settings Apple have put in place. By doing that you are making that system vulnerable.

@markhu

This comment has been minimized.

Copy link

@markhu markhu commented Sep 7, 2018

I'm running High Sierra, but for some reason I didn't need to disable anything before running the pkill NotificationCenter command. Alternate approaches are discussed at https://apple.stackexchange.com/questions/325547/how-do-i-dismiss-many-multiples-of-the-disk-not-ejected-properly-notification

@h4rm0n1c

This comment has been minimized.

Copy link

@h4rm0n1c h4rm0n1c commented Jan 18, 2019

It is never a good idea to disable the security settings Apple have put in place. By doing that you are making that system vulnerable.

No more vulnerable than prior versions of OS X before SIP came along in the first place. If you're at the stage where all that's protecting you is SIP, you might as well give up on security entirely.

SIP is practically the same as the equivalent system file protection in Windows, if you are concerned about malicious software modifying system files, I'd be trying to prevent such software getting on my machines in the first place.

@DelphiDoop

This comment has been minimized.

Copy link

@DelphiDoop DelphiDoop commented May 3, 2019

Is it possible to disable SIP, then disable notification center then re-enable SIP? I work in production and my macbook has one very specific use case, to run a program for production video, so I don't need notifications, however, I sometimes use this computer to browse the internet. Just wondering what the best solution is to disable notification center. I've already disabled each app.

@Tonyliu2ca

This comment has been minimized.

Copy link

@Tonyliu2ca Tonyliu2ca commented May 8, 2019

It works: disable SIP, make your modifications, and then enable SIP.

@Whoaa512

This comment has been minimized.

Copy link

@Whoaa512 Whoaa512 commented Oct 15, 2019

Doesn't work on Catalina, even with SIP disabled. However you can hold option (alt) and click on the Notification Center icon to disable it

@shadowbq

This comment has been minimized.

Copy link

@shadowbq shadowbq commented Jan 8, 2020

@Whoaa512 Catalina is supported with node/npm cli .. do-not-distrub on via https://github.com/sindresorhus/do-not-disturb-cli.
It basically just sets the doNotDisturb & dndprefs_changed with a 1440 minute count to dndEnd
Main library: https://raw.githubusercontent.com/sindresorhus/do-not-disturb/master/Sources/do-not-disturb/DoNotDisturb.swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.