動作確認環境

MacBook Air 2017
macOS High Sierra 10.13.4

おやすみモードを有効化する

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean true
defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate -date "`date -u +\"%Y-%m-%d %H:%M:%S +0000\"`"
killall NotificationCenter

おやすみモードを無効化する

defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean false
defaults -currentHost delete ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturbDate
killall NotificationCenter

参考

How to enable/disable Do Not Disturb from shell on Mavericks?
https://apple.stackexchange.com/questions/145487/how-to-enable-disable-do-not-disturb-from-shell-on-mavericks

Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.