Mac – Remove Mac App Store notification badge from the Dock

dockmac-appstorenotifications

# "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

How to apply such a script for the Mac App Store so that it will appear in Notification Center Settings? I don't have a clue on how to change the script above to work with the App Store 🙁 I want to avoid system updates and I would like to get rid of the numbered badge on the icon in the Dock. Thank you in advance!

Best Answer

Just a Workaround (tested with 10.11.3):

  1. Open ~/Library/Preferences/com.apple.dock.plist with en Plist-Editor of choice (e.g. Xcode).
  2. Open the property(array) with name "persistent-apps".
  3. In this array is an item for each persistent application(the ones that stay if you close the app) in your Dock. The Finder in first position of Dock is NOT in this list! The first application after the Finder is in "Item 0", the second in "Item 1" and so forth. Find the item number in the array where you have the App Store and open the item to see the sub properties.
  4. Open property "tile-data" as well. Now you should see a sub property "dock-extra" of type BOOLEAN.
  5. In the property "file-data/_CFURLString" or the property "bundle-identifier" you can check if you really found the correct item number for the App Store.
  6. Change the value of from "dock-extra" from YES to NO and than save and close the plist.
  7. Restart your Dock at a terminal with command "killall Dock" or reboot your system.

I create a small shell script that does the same job. It uses the terminal tool "PlistBuddy" that comes together with Xcode.

#!/bin/bash
/usr/libexec/PlistBuddy -c "set persistent-apps:7:tile-data:dock-extra false" ~/Library/Preferences/com.apple.dock.plist
sync
killall Dock

The "7" in the script stands for the array position of the app store in the dock as explained in step 3 above (and needs to be adjusted to your configuration).

This method has still problems:

  1. The red notification badge of App Store is only gone as long as the App Store is closed. As long as you open the App Store you see the red notification badge anyway.

  2. When you move the position of App Store in your Dock (maybe because you add a new application to it) the "dock-extra" value is automatically reset to "YES" and you will see the red notification badge again. Than you need to repeat the process for the new Item position of the App Store in your Dock.