8

Prior to Yosemite, Notification Center settings stored in an sqlite db in ~/Library/Application\ Support/NotificationCenter/ Now this folder does not exist anymore, where does the OS store those settings?

TIA!

1
  • The place is found by your accepted answer though there's not really a path named. Get the "readable" path by applying G.H.'s command without "cd"; some more information in my "own" answer. Dec 18, 2018 at 17:39

4 Answers 4

10

The database has moved on Yosemite. The following command takes to you to its new location:

cd `getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db
2
  • can you please elaborate on you answer.
    – markhunte
    Jan 22, 2015 at 15:02
  • 3
    I've edited to try and elaborate but the question is a simple 'where is x on Yosemite' and the answer is a similarly simple 'it's here'. Jan 23, 2015 at 11:01
3

FYI, the location has moved. It is now:

cd `getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db2
1
  • This is not where the notification settings are stored. The DB only stores badge status per app, how many notifications it has delivered/displayed, mute status and pending requests. But if you make changes to notification settings in system preferences, the database there isn't touched at all. This is only where notification and current notification state per app is stored. The settings are stored in com.apple.ncprefs.plist in ~/Library/Prefenreces.
    – Mecki
    Sep 5, 2023 at 10:36
1

The notification settings are stored in

`~/Library/Preferences/com.apple.ncprefs.plist`

nc stands for Notification Center.

The database at

`getconf DARWIN_USER_DIR`/com.apple.notificationcenter/db2

only stores the notification state per app, i.e. if an app icon should have a badge (and what number that badge should display), if the user has temporary muted notifications for an app, how many notification has an app delivered, how many of those are currently displayed, how the notifications of an app are currently grouped together, and so on.

So the database is constantly updated whenever a notification is generated by an app or received via push notifications and displayed to the user. But if you make changes to the notification settings in the System Preferences, that database is not touched at all only the Plist is altered.

Also if you delete the database (and kill the notification center processes), all notification state is lost but none of your settings will be lost. On the other hand, if you delete the Plist (and kill all notification center processes as well as cfprefsd), all your notification settings are lost but none of your notification state.

2
  • I am interested in the settings in ~/Library/Preferences/com.apple.ncprefs.plist I wonder if you understand the entries inside it - there are flags and 'auth' constants... Also, how can it only be 'user level' when you modify settings for an app - it applies to ALL users? Apr 3 at 14:54
  • What API (posix, Cocoa, other?) replaces the getconf DARWIN_USER_DIR if I can't run external process from my code that needs access to the notification db? Apr 4 at 6:29
0

Because I was looking for the file that notifications are stored in I came to this page (using macOS 10.13.6 High Sierra).
Here are some facts:

getconf command … with the DeviceVariable and DeviceName parameters, [returns] the value of the disk device name or location, for the device path specified by the DeviceName parameter

The above code returns (with "cd" omitted!): /var/folders/_d/pg2g__g17nzfwrv64j8ddvn80000gn/0//com.apple.notificationcenter/db: is a directory
Inside this/my folder I found: db db-shm db-wal db2upgraded

When some action takes place (I sent a notification) only db-wal gets updated immediately. So notifications are "registered" there somehow; interestingly, recurring ones are listed several times, meaning, a kind of "history" could be created once the db code is "translated".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .