Posted on 03-27-2019 12:13 PM
Our standardized testing program uses a locked-down browser, and will kick out a tester, if anything tries to do something in the background. We think that a number of students were kicked out of their tests because they set up Mail.app and got a notification.
Rather than try to play cat and mouse with alert settings, is there a way to completely disable the Notification Center? I tried putting Notification* as a Restricted app, that gets killed, but that seems to have had no effect.
We are currently running 10.12.6, but are going to move to Mojave this summer, so I need a solution for each OS.
Under Mavericks, you could disable the LaunchAgent:
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
but that doesn't work under Sierra, so I bet it doesn't work in Mojave either.
Should I just nuke the agent with:
sudo rm -rf /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
Will I be able to do that in Mojave?
Ideally, I'd like a Configuration Profile that just turns NC completely off, but the closest I have found isa script that turns on Do Not Disturb. There's gotta be a better way, right?
Thanks in advance!
Posted on 03-27-2019 12:49 PM
sudo rm -rf /System/Library/LaunchAgents/com.apple.notificationcenterui.plist
The above won't work because of SIP, which is the same reason you can't disable the LaunchAgent with the launchctl unload
command.
Honestly, I don't know of any good way to disable Notification Center these days. Apple has made it monumentally difficult to turn off some of the services in their OS lately, which is very frustrating. We always seem to have to jump through hoops or use sketchy scripts and other processes to do it, which inevitably end up breaking in the next major OS release.
I wonder if the vendor for your locked down browser can help. Maybe they can make some changes to it that will prevent kicking out a student due to a simple notification, which seems a bit extreme anyway.
Posted on 03-27-2019 12:59 PM
A colleague has resorted to placing posters in the computer lab and informing every instructor/proctor to check that Do Not Disturb is enabled before testing. They just instruct the users to option-click the notification center icon in the menu bar to enable, and I believe that remains active for 24 hours before resetting.
Posted on 03-29-2019 01:13 AM
We make use of this script (it affects the user template, works with newly created accounts)
MAC_UUID=$(system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}')
for USER_TEMPLATE in "/System/Library/User Template"/* do /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "dndEnd" -float 1379 /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "doNotDisturb" -bool FALSE /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID "dndStart" -float 1380 done
exit 0 ## Success
exit 1 ## Failure
Posted on 03-29-2019 05:29 AM
That is cool, but is there anything (other than blocking the preference pane) that keeps users from turning DND off?
Posted on 04-19-2021 05:00 PM
I created a plist for Notification Center (com.apple.notificationcenterui.plist) that enables Do Not Disturb from 00:00AM to 11:59PM
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>dndEnd</key>
<real>1439</real>
<key>dndStart</key>
<real>0.0</real>
<key>doNotDisturb</key>
<false/>
</dict>
</plist>
Then I created a package (+ a rule) to copy the com.apple.notificationcenterui.plist in a folder on the target Mac (/usr/local/)
Posted on 04-19-2021 05:04 PM
Then I created a rule, that execute at login to run the following script:
CURRENT_USER=$(/usr/bin/stat -f%Su /dev/console)
MAC_UUID=$(system_profiler SPHardwareDataType | awk -F" " '/UUID/{print $3}')
cp /usr/local/com.apple.notificationcenterui.plist /Users/$CURRENT_USER/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID.plist
chown $CURRENT_USER /Users/$CURRENT_USER/Library/Preferences/ByHost/com.apple.notificationcenterui.$MAC_UUID.plist
killall NotificationCenter
Posted on 04-20-2022 01:56 PM
It looks like this has been changed again. I don't see "com.apple.notificationcenterui" on my Monterey system.
Instead, there is "com.apple.ncprefs.pslist", and while it has a dnd setting buried in there, it appears to be encoded in some way since it's just a block of seemingly random characters.
Posted on 08-02-2023 07:14 AM
No updates to this thread in 16 months. I guess that means a new solution has not been found. My lab and classroom computers have no use for Notification Center (and in fact, it creates more clutter and chaos than anything else) and I would love to get rid of it.
Posted on 02-28-2024 08:42 AM
I'm looking for a solution to this as well, now in 2024!