Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

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

share|improve this answer
    
it doesn't seem to work. I tried setting it to false and then triggering a notification through terminal-notifier, and it pops right in, with keelalive false and true. Do I need to do anything else? On the other hand, any chance on not doing it with sudo? Thanks! –  Ramiro Araujo Apr 6 '13 at 3:36
1  
Added method without sudo. If it's still not working for you please give me code-error return in terminal. –  MnO Apr 6 '13 at 11:40

I just simply alt-click on the menubar icon, which actually greys it out and disables it until clicked on again.

share|improve this answer
2  
Didn't know that, thanks. The question asks for a commandline solution though. –  patrix May 30 '13 at 5:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.