For nuisance apps that set a badge notification icon, but which are not in the Settings Notifications center, is there a way to block the badge icon?


Spotify, for example, creates a notification for every insignificant event, with no way of blocking it in app.

Personally I don't understand how apps are allowed to show a badge icon without being in the Notifications center in the first place.


Example:

enter image description here

up vote 26 down vote accepted

I have a solution that I was able to reverse engineer. I've tested it on my machine, running Yosemite 10.10.4 (14E46). If you can find the bundle ID (in the Info.plist file for the app bundle), you can use this script to force the app to appear in the notifications preferences pane.

# "Usernoted" seems to be the "user notifications daemon", so get it's PID.
pid=$(ps aux | grep -i [u]sernoted | awk '{print $2}')

# Find the sqlite3 database that this program has open. It's in a "private" folder (app sandboxing).
db="$(lsof -p $pid | grep com.apple.notificationcenter/db/db\$ | awk '{print $9}')"

# I got the bundleid from Spotify.app/Contents/Info.plist
bundleid="com.spotify.client"

# I use 0 as the flags because you can change all the settings in System Preferences
# 5 seems to be the default for show_count
# Grab the next-highest sort order
sql="INSERT INTO app_info (bundleid, flags, show_count, sort_order) VALUES ( '$bundleid', 0, 5, (SELECT MAX(sort_order) + 1 FROM app_info) );"

# Run the command
sqlite3 "$db" "$sql"

# Restart usernoted to make the changes take effect
killall usernoted

At this point you can open System Preferences -> Notifications, and you will find the app that you just added at the bottom of the list. You can enable / disable badging the icon from this page.

  • 2
    Very clever solution, thank you Ryan! (Although I've now 'fixed' it by dropping Spotify and switching to Apple Music.) – Jon Cox Jul 7 '15 at 11:22
  • 1
    FINALLY, a solution for this horrible niggle. Thank you * 1000. – Josh Harrison Jul 17 '15 at 14:40
  • 1
    You're the man. – Udi Aug 5 '15 at 16:01
  • 1
    Brilliant! Thanks. – Cagdas Altinkaya Oct 7 '15 at 5:44
  • 1
    I just want to confirm, that this solution still works! – 23tux May 4 '16 at 21:13

For those people who are mac noobs like me, to create and run the above script:

1. Open TextEdit,
2. Put the editor into Plain Text mode - Format > Make Plain Text.
(If you skip this step, it will not let you save it as a script.)
3. Paste the above script into the TextEdit window
4. Save the file as a script - File > Save As in TextEdit. Enter your filename followed by the “.sh” file extension, and then Save the document to the Desktop.
5. Open the Terminal application
6. Navigate to the desktop in Terminal - Type in (then press enter):

cd Desktop
7. Set the permissions for the file you just created so you can run it - Type in Terminal (then press en):
sudo chmod 700 file.sh
(Replace "file.sh" with the name of your script.)
8. Run the file - Type in Terminal:
./file.sh
(Again, replace "file.sh" with the name of your script.)
9. Open Notifications in System Preferences. You should be able to find the Spotify App and turn off the notifications.

Source for creating a script: Terminal 101: Automate the Terminal with Bash Scripts

  • Good tutorial on making an executable shell script, but for the upvoted solution you don't need a bash script. Just open terminal and paste in the commands. Skip lines that begin with a #, because that is a comment in bash. – y3sh May 27 '16 at 20:30

protected by Community Dec 28 '15 at 10:06

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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