23

Hey I was playing around with making a small cocoa application and using the new Notification Center API in Mountain Lion. However my app is now present in the notification center settings, together with Calendar, Messages and so on.

As it was just me playing around I want it to disappear from the list now, but I cannot find anyway to remove it, tried several things, dragging it out, holding alt+right click and so on. Does anyone know where the (probably a) plist that populates that list could be located?

11 Answers 11

33

I was stuck in the same boat.

While I don't believe purging applications from Notification Center that have once registered is a documented step, there's clearly some stuff setup to do that. Here's what I found out. This data isn't stored in a plist but rather a sqlite database.

If you look ~/Library/Application Support/NotificationCenter/<id> (in my case, I only had one directory under NotificationCenter), you'll see an <id>.db file under the directory.

Editor's note: Hofi points out that since macOS 10.10 said SQLite database can be found in the directory returned by shell command
$(getconf DARWIN_USER_DIR)com.apple.notificationcenter/db, named just db. jbg notes that as of macOS Monterey (12.x), the directory path is now $(getconf DARWIN_USER_DIR)com.apple.notificationcenter/db2, and the db database's app_info table has been renamed to app.

Poking inside, I see tables like app_info, app_source, presented_notifications, etc. Furthermore, the schema includes a clean-up trigger that looks like this:

CREATE TRIGGER app_deleted AFTER DELETE ON app_info
BEGIN
    DELETE FROM scheduled_notifications     WHERE app_id=old.app_id;
    DELETE FROM presented_notifications     WHERE app_id=old.app_id;
    DELETE FROM presented_alerts                WHERE app_id=old.app_id;
    DELETE FROM notifications                   WHERE app_id=old.app_id;
    DELETE FROM app_push                        WHERE app_id=old.app_id;
    DELETE FROM app_loc                     WHERE app_id=old.app_id;
     DELETE FROM app_source                 WHERE app_id=old.app_id;
END;

Using a sqlite3 client, if you do a

select * from app_info;

the first column is the app_id of your application, the second column is your app's bundleid. Find your application based on the bundleid. Then do a

delete from app_info where app_id = <app_id>

where <app_id> is the correct app_id you found using your select command above.

What was frustrating was that after doing this, everything stayed around in NotificationCenter (both the center and System Preferences). I had to logout and log back in to see the changes take effect, but luckily, my multiple test apps are now gone ;-)

If anyone knows of a less convoluted way, I'm all ears.

4
  • 6
    You can sudo killall usernoted to avoid having to logout. Mar 12, 2013 at 20:28
  • 7
    on 10.10 the db moved to get the location run this from terminal cd $(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/db
    – Hofi
    Sep 26, 2015 at 1:36
  • After deleting the entry is reinserted after reboot.
    – powder366
    Apr 8, 2017 at 7:41
  • 3
    The DB is now in the $(getconf DARWIN_USER_DIR)com.apple.notificationcenter/db2 directory. It's still called db and is still an SQLite database. The app_info table has changed its name to app.
    – jbg
    Jan 22, 2019 at 8:32
16

Highlight the app in the list and hit fn+backspace or del/delete if you have that on your keyboard.

5
  • Roses are red, violets are blue, for helping me, I now love you too.
    – Starwave
    Feb 8, 2021 at 19:00
  • Thanks a lot, this is a way easy solution than the rest :-)
    – anceque
    Feb 10, 2021 at 10:31
  • Have another upvote so this gets seen by more people. Thank you.
    – inexcitus
    Mar 9, 2021 at 14:50
  • This solution worked for me on Catalina. Oct 6, 2021 at 4:06
  • Much better than a bunch of SQL commands.
    – Trygve
    Jul 19, 2022 at 21:49
7

If you delete the application (might need to empty the trash as well) and log out and back in, it gets removed from the list.

1
  • 2
    This is what ultimately did it for me (no files were in ~/Library/Application Support/NotificationCenter).
    – theory
    Jan 9, 2015 at 22:05
5

I had trouble with BetterTouchTool not disappearing from the Notification Center after uninstall. Unfortunately, the methods mentioned here didn't work for me but I figured it out eventually.

For anybody having trouble getting this to work under High Sierra:

  1. In terminal, navigate to NotificationCenter folder:

    cd $(getconf DARWIN_USER_DIR)/com.apple.notificationcenter/
    
  2. get path using pwd and copy to clipboard (should be something like /var/folders/c3/289nmdsd2cz68yd5p47k553w0000gn/0/com.apple.notificationcenter)

    pwd
    
  3. In finder, go to folder (cmd+shift+g) and paste path
  4. Find the folder containing the db file and drag the entire folder to the trash (I had only one folder named "db2")
  5. Empty Trash! (This is very important, didn't work on my machine without it)
  6. Log Out and In again

There might be a more elegant way but this worked for me. Note that for some reason, the Database gets rebuilt with the application_id still present in the db-table (which is called app instead of app_id on High Sierra, btw), however the entry disappeared from the notification center.

1
5

The following, perhaps heavy-handed approach seems to work for me when I get into this mess. It avoids changing AppID/etc. at least.

  1. Quit XCode
  2. rm -rf ~/Library/Developer/Xcode/DerivedData/*
  3. killall usernoted
  4. killall NotificationCenter
  5. rm ~/Library/Application Support/NotificationCenter/*
  6. Open System Preferences → Notifications (this seems to restart everything)

Reboot/log out is not required in this method.

1
  • I'd say this is the best solution, personally.
    – Epaga
    Oct 28, 2019 at 9:40
2

I simply renamed the file in the NotificationCenter folder, then rebooted. A new file was created which was populated with just the default apps.

1
  • What was the original name (full path?) of file you renamed? And does doing this reset all preference settings for the Notification Center? Sep 24, 2012 at 13:04
1

For macOS Catalina, the path to the db can be found with lsof -p $(ps aux | grep -m1 usernoted | awk '{ print $2 }')| awk '{ print $NF }' | grep 'db2/db$' | xargs dirname

0

You can do this easily from Xcode.

Open Organizer, and select the Projects tab at the top. You will see a list of all your applications on the left side. For any application you want to remove, select it from the left-hand menu and choose Delete... for the Derived Data.

This still retains any user settings in Notification Center, as well as the notifications themselves.

0

Change the code in the project which you were playing around with user notifications in to call

[[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications];

from your app delegate's method -applicationDidFinishLaunching:. This will remove all user notifications from the user notification center.

2
  • 1
    Hmm can't compile if I try to use SCIUserNotificationCenter class there's none. However it did compile if I changed to NSUserNotificationCenter, but my app remains in the list. removeAllDeliveredNotifications is probably just a way to clear any current notifications. Your app will still be present in the notification center list.
    – robahl
    Sep 17, 2012 at 16:04
  • edited to fix the typo--using the wrong prefix on the user notification center. Sep 18, 2012 at 15:55
0
  1. Go to Finder
  2. Search Macintosh HD under the tab "This Mac"
  3. Click Applications
  4. Press Shift + Command + G
  5. Type in ~/library
  6. Click Application Support
  7. Click Notification Center
  8. Drag the only file that's there to the Trash
  9. Quit all on going apps
  10. Empty Trash
  11. Restart

Tadaaa! The application has been removed to your Notifications Center permanently based on personal experience.

0

I was trying to remove a notification, but in my case it was for a website (9to5mac) to be exact. I could SEE it in System Preferences | Notifications and set it to be disabled, but I continued to get notifications. I finally figured it out. For websites you have to go into Safari, then Safari Preferences | Websites, then Notifications, then find the website and either set it to Deny or just remove it altogether. I removed 9to5mac here and once I did, it was gone from the general Notification Center as well, what a pita! but at least there is a way.

Also from my searching I too opened the notification DB file with a sqlite browser and my web notification "app" was not to be found, so you have to delete/disable it in Safari instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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