Can't restore my notes on macOS
It might be possible to recover the text of your notes. I cannot gaurantee this will work for you, but I've tried this in High Sierra and it worked for me. There might be an easier way, I'm not sure.
Using Finder or Terminal check in the following directory (Note - this may well be a different directory from the one you tried first)
~/Library/Group Containers/group.com.apple.notes
for the following file
NoteStore.sqlite
(In Finder, select Go
->Go to Folder
, enter ~/Library/
, then navigate to the dir shown above)
If this file exists, copy it to your Desktop. (Otherwise, sorry, game over, although someone else might know otherwise)
You will now need mac_apt
(macOS Artifact Parsing Tool) to analyse this file.
Download a compiled bundle of mac_apt for macOS from
https://github.com/ydkhatri/mac_apt/releases
I had to use the 10.13 bundle on High Sierra.
Using terminal, then cd into the mac_apt directory you have downloaded.
cd ~/Downloads/<name of mac_apt directory>
You should see the following two files:-
mac_apt_singleplugin.app
mac_apt.app
Now you need to run mac_apt_singleplugin.app
to analyse your Notes sql notes db
In terminal, run the following in the mac_apt download directory
./mac_apt_singleplugin.app/Contents/MacOS/mac_apt_singleplugin -i ~/Desktop/NoteStore.sqlite -o ~/Desktop/NotesOutput NOTES
This should create ~/Desktop/NotesOutput
Inside this directory will be a log .txt file, and if you are lucky, a Notes.csv
file. The csv file can be opened in any spreadsheet e.g. Numbers, and you can search through its fields to find the text of your notes if they were in the original file. You can copy / paste these into text files. Alternatively it might well be possible to run a script to pull out particular csv fields into individual text files - someone here may be able to help you with that particular problem.
Here's what worked for me :
-
locate the original (corrupted/damaged) NoteStore.sqlite as described in the previous messages (make a backup copy just to be sure)
-
fix the db with sqlite3 https://www.sqlite.org/download.html
-
The ".recover" command worked for me :
sqlite3 broken.db ".recover" | sqlite3 new.db
(where broken.db is the original NoteStore.sqlite)
I also had tried the ".dump" one but it didn't work (the procedure described here https://docs.locusmap.eu/doku.php?id=manual:advanced:map_tools:corrupted_sqlite ).
Rename new.db to NoteStore.sqlite and paste it where the original one was in the ~/Library/Group Containers/group.com.apple.notes folder, leaving the other two original files (shm and wal).
Restart you macbook, and then (at least for me) the notes were back in their place (including the ones protected by password, that in my case were not recovered my mac_apt).
Note that I performed the sqlite3 step on windows 10, but I guess that the precompiled MacOS version that you find on the official website should work in the same way.