Skip to content

Instantly share code, notes, and snippets.

@mikermcneil
Last active July 10, 2023 10:51
Show Gist options
  • Star 55 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save mikermcneil/10005651 to your computer and use it in GitHub Desktop.
Save mikermcneil/10005651 to your computer and use it in GitHub Desktop.
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.

@shiypc
Copy link

shiypc commented Aug 31, 2021

to anyone using sierra or later, DO NOT LAUNCH SIRI WHILE USING THIS!! it causes a bunch of problems, and last time i tried, i wound up logging out entirely.

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