Create a gist now

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.

Show comment
Hide comment
@gianpaj

gianpaj 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

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.

Show comment
Hide comment
@ozdv

ozdv Feb 13, 2018

No longer works with macOS Sierra 10.12

ozdv commented Feb 13, 2018

No longer works with macOS Sierra 10.12

@xbeta

This comment has been minimized.

Show comment
Hide comment
@xbeta

xbeta Mar 11, 2018

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

xbeta commented Mar 11, 2018

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

@jd20

This comment has been minimized.

Show comment
Hide comment
@jd20

jd20 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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment