MacOS – Temporarily disable Notification Center in Mountain Lion from command line

command linedefaultsmacosnotifications

I've been trying to create a script to disable/enable the Notification Center, even if it's temporary. It should do the same as manually sliding the Notification Center, scrolling up, and toggling the "Show Alerts and Banner" badge.

Anyone knows if it's posible and how to do it? 🙂

Thanks!

Best Answer

To disable Notification Center from the command line, write a KeepAlive key that is false into the /System/Library/LaunchAgents/com.apple.notificationcenterui.plist like so:

sudo defaults write /System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive -bool false  

If you want to re-enable Notification Center, you’d just run the same with a true:

sudo defaults write /System/Library/LaunchAgents/com.apple.notificationcenterui KeepAlive -bool true  

Method to DISABLE without sudo:

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

Method to ENABLE without sudo:

launchctl load -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist  

Then just hit Command+Shift+G and go to /System/Library/CoreServices/ then find “Notification Center” and double-click it to launch it again

Tutorial with useful info here and here