Skip to content

Instantly share code, notes, and snippets.

@giu1io
Last active August 29, 2015 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save giu1io/3be17b5c5cb9b043774f to your computer and use it in GitHub Desktop.
Save giu1io/3be17b5c5cb9b043774f to your computer and use it in GitHub Desktop.
Shell script that removes all notifications from Notification Center on OSX
#!/bin/bash
# Thanks @LucaTNT for making the script work on < 10.10
MAJOR_OSX_VERSION=$(sw_vers -productVersion | awk -F '.' '{print $2}')
if [[ $MAJOR_OSX_VERSION -ge 10 ]]
then
DB_PATH=`getconf DARWIN_USER_DIR`com.apple.notificationcenter/db/db
else
DB_PATH="$HOME/Library/Application Support/NotificationCenter/"
DB_PATH=$DB_PATH`ls "$DB_PATH"`
fi
sqlite3 "$DB_PATH" "DELETE FROM notifications WHERE 1"
killall usernoted
killall NotificationCenter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment