MacOS – Notes.app’s iCloud notes database location(s) for recovery (El Capitan)

data-recoverymacosnotes.app

I lost a note from the Notes.app and need to recover it. I have the entire content of my HD backed up (both online and with TimeMachine) so I thought it'd be easy. However, I can't find up-to-date information on where notes are stored on current installations of El Capitan.

It seems that notes are no longer stored in either
/Users/yourUserName/Library/Containers/com.apple.Notes or
/Users/yourUserName/Library/Group Containers/group.com.apple.notes
which is what other threads on this site and elsewhere claim. (See here. I also tried the solution suggested here but it did not work for me.) Maybe this behavior changed in the meanwhile.
I have checked the versioning entries of the databases in both of these locations an they all didn't get updated since May.

Anyone out there who knows where notes are stored on current installations of El Capitan? What folder to replace to get them back?

Any help much appreciated!

Note:
– I am referring to an "iCloud" note that I need to recover, not the "On My Mac" note. I do not use "On My Mac" notes.
– My iCloud notes get synced with my iPad too, but it is not available anymore under "recently deleted notes". I also looked on icloud.com but to no avail.
– When I opened the Notes.app on the iPad that particular note was still visible on the screen as I had been working on it (I had not opened the app on the iPad for a month). After it refreshed the note was gone.

EDIT (after a few more unsuccessful attempts):
Since it seems that when iCloud is disabled Notes won't read any "iCloud" notes (which is logical …) the best strategy would be to close the Notes.app, then download a past version of whatever that magic folder is that holds the current iCloud notes, cap the Internet connection, replace the current notes folder with the backup and then start Notes again, copy the missing note somewhere else, and then reestablish the Internet connection.
But I'd need to know what that magic folder is on El Capitan … anyone any ideas?

EDIT2:
Could it be that Notes stores "iCloud" and "On my Mac" notes in different places? Via this script I was able to extract the content from the backup of the NotesV6.storedata database within com.apple.Notes, but the missing note did not show up. It seems the notes contained in that database were either even older than May, or they were "On my mac" notes, from some time before. I had moved all my notes to iCloud earlier this year (but before May) so I think the NotesV6.storedata database in com.apple.Notes might contain the on my mac notes.
Now group.com.apple.Notes was also changed last time in May but I have a slight hope that if those are the iCloud notes, some version of that note was already there. But the data there seems to be stored in a different format, there is no NotesV6.storedata file, and so the script mentioned also did not work. Any ideas?

I'd highly appreciate any hints what I might try and where I might look!

Best Answer

This is not a direct answer to the question "What is Notes.app's iCloud notes database location(s)" but it might be useful information for others who need to recover an iCloud-synchronized note.

Given my lack of success with everything I tried I called Apple support. They were very helpful and after a few unsuccessful attempts replacing folders they looked into my iCloud account and found that on their end there was "one recoverable item" that showed up. After verifying my identity they could then "recover" that item and, voila, the missing note popped up in the notes app under Recently deleted items. It had been deleted beginning of September. Had I only known it was that easy ...

So it seems that deleted iCloud notes are not permanently deleted after 30 days and still recoverable by Apple. I forgot to ask if forever, or for how long ...

In any case, while I've resolved my problem I'd still be interested in the actual location of the iCloud-notes database. So if anyone comes across this at some point and finds the answer it'd be highly appreciated.