Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Recovering corrupted notes

For some reason iCloud blew up my Notes (after blowing up my Numbers files earlier this week). So, after searching around these discussions, I found out that a Notes backup of the iCloud file exists in Containers or Mobile Documents, from which I should be able to restore from Time Machine. Except for the sad fact, that neither folder exists in prior Time Machine backups, they only exist in the current Finder. I have no clue how to get around that.


Then I realized, I save my iPhone and iPad to my iMac weekly, and the good version of my Notes is in there. I tried it. Unfortunately, a few seconds after opening Notes, it synced and overwrote my Notes from the corrupted iCloud version (which deleted all but the oldest Note). You can shut off Wifi and Cellular prior to restoring the iDevices, but unfortunately, the restore will turn them back on, and iCloud's evil self takes over and blows up my Notes.


Assuming that Time Machine is a lost cause (but willing to be pointed in the right direction to find where the Notes backups are), how can I make this iPhone's correct version of notes overwrite the iCloud version. Or give me sufficient time where I can email myself each note and then re-enter it. Or do something to save it.

Posted on Jul 8, 2014 1:36 PM

Reply
7 replies

May 28, 2017 5:58 PM in response to dianeoforegon

I know this is old, but I went thru this very frustrating problem myself today. There are a lot of references to the Notes.app data being stored in ~/Library/Containers/..., but since El Capitan & when iCloud is turned on for Notes.app, the data is stored in ~/Library/Group Containers/group.com.apple.notes/*. Here is where all the local data is written. However, if you turn off iCloud for Notes in System Preferences, the Notes.app will not present this data to you (yes, your own data is not available to you)

Instead, Notes.app will show no data at all. Any new data you enter at this point (I think) now goes to the other directory (~/Library/Containers/...), which is what we don't want! The only way to defeat this as far as I know is the following:

1. Turn iCloud sync back on in System Preferences

2. Unplug Ethernet connection & turn off WiFi (we do not want any Internet connection)

3. Open Notes.app. This forces Notes to use your local data cache (~/Library/Group Containers/...), but without "interference" from iCloud. At this point you can verify you corrupted or missing note data.

4. Close Notes.app

5. In A UNIX Terminal window (in Terminal application) cd to your Group Containers folder like so: cd ~/Library/Group\ Containers

6. Archive the group.com.apple.notes folder like so in the same Terminal window (the command should be entered on a single line regardless of how this looks in this posting):

tar cvf

group.com.apple.notes.tar group.com.apple.notes

The above creates a archive tar file that will be used later to restore the original folder and content.

7. The remaining steps presume you have your own or Time Machine backups available. If you don't have backups of your data available you're done. Just give up at this point and reconnect your WiFi or Ethernet and check it off as a lesson learned & start backing up your stuff! You can optionally delete the tar file you just created if you don't want to use that as your first little backup:).

8. If you're continuing now good for you!

9. Attach your backup volume to your computer. Please note that at this point you cannot access the backup over WiFi or Ethernet because activating a network connection at this point will result in syncing to iCloud again and we DONT WANT THAT! Therefore, the backup will have to be locally connected.

10. In the same Terminal window enter the following command to delete the

group.com.apple.notes folder and everything in it (I say same Terminal window only because it's the one that is cd'd to your Group Containers folder. You could use another Terminal window, but it better be cd'd to the same place or the following command won't work):

rm -r

group.com.apple.notes

11. Verify the

group.com.apple.notes folder is gone and that only the tar file is present by doing a listing of the current directory as follows:

ls-l

12. Now you need to copy the same folder and all of its content from your backup volume and place it in the current directory you're cd'd to. The best way to do this is to avoid the GUI (Finder) and use the rsync command, especially if we plan to try several backup versions of the

group.com.apple.notes folder until we find your good notes. Since I don't know where your backups are I will show an example with explanation. Let's say your backups are located here:

/Volumes/myBackup/

And, your

group.com.apple.notes folder is located here:

/

Volumes/myBackup/Me/Library/Group Containers/group.com.apple.notes

Copy the backup to the destination as follows with the rsync command (again, this command is all on one line, so drag the edge of the Terminal window wide to accommodate):

rsync -av --del /

Volumes/myBackup4/Me/Library/Group Containers/group.com.apple.notes .

Please note that the space followed by the dot at the end is required in the above command! The -av tells rsync to use archive mode (a) and verbose (v), so you can see it work. The --del option will delete files in the destination first if they don't exist in the source. This is going to be usefull when we repeat the same rsync command for different versions of the source backups, as we don't want previous files from a prior version left in place when copying the next version to the destination.

13. When rsync is done doing the above restore open Notes.app. See if your missing notes or corrupted notes are back or intact. If they are not, close Notes.app.

14. Issue the same rsync command again (use the up arrow to recall the last command and make a change of the source location. For example change the myBackup4 to myBackup3. Enter that command and rsync will first delete any old or non-existing source files in the destination and copy the different files from the source to the destination.

15. Open Notes.app again & see if this version has what you're looking for.

16. Repeat steps 13 & 14 until you get your desired notes back.

17. When you have your notes back, make a copy of the notes of interest content to one or more files at a different location. I used TextEdit to create a file for each note of interest and saved them in a folder called Resurrected _Notes.

18. Close Notes.app

19. In the Terminal window that is cd'd to your Group Containers directory delete the

group.com.apple.notes Folder like so:

rm -r

group.com.apple.notes

20. Restore the original

group.com.apple.notes folder and content from the tar file you made like so:

tar -xvf

group.com.apple.notes.tar

21. Do a listing to verify it is back as follows:

ls -l

22. Turn on WiFi and/or plug in the Ethernet cable. At this point Notes.app will re-sync your restored

group.com.apple.notes to iCloud which will contain your original problem (missing and/or corrupted notes), but that's OK because you now have the good stuff copied elsewhere. Using an editor of your choice copy the note content and put them back into the Notes.app

23. Whew, you're done! You can now clean up by deleting the tar file in you Groups Containers folder like so:

rm

group.com.apple.notes.tar

Careful, don't delete

group.com.apple.notes!!!


Please, especially if this worked for you, give me some points and help me post this solution to the numerous other relevant threads in the Apple Discussions site! Most are highly misinformed and void of real solutions.

Jul 8, 2014 6:14 PM in response to dianeoforegon

I don't think that's going to work. The corruption is in iCloud. I have a full backup of my iPhone and iPad which should have my uncorrupted notes sitting on my iMac.


I've tried to get that backup onto my iPhone, which I can. But what happens is that I get a near instantaneous syncing over the air of Notes with corrupted iCloud version, so I lose everything. I actually changed my Apple ID password, but that didn't do anything. In fact, I'm kind of blown away that changing my password didn't lock out iCloud from my iDevices. Very lame.

Jul 8, 2014 6:45 PM in response to OrangeMarlin

Turn off iCloud sync for Notes on all devices.


Put the notes in the new User via Shared folder.


Your Hard Drive/Users/Shared


Option drag these folders to Shared to copy: (The "~" represents your Home folder. If you don't see Library in your Home folder, hold Option and click the Go menu.)

1) Copy the whole ~/Library/Containers/com.apple.Notes/ folder

2) ~/Library/Application Support/MobileSync/Backup/



Drag from Shared (it actually copies) and place on Desktop.

Move the data into correct location in new User.


Syncing via iTunes should allow you to upload to iPhone.


iOS: Back up and restore your iOS device with iCloud or iTunes

iTunes: About iOS backups


Once you get the data on your phone you'll need to clean up iCloud notes before syncing back.


You might want to consider other options for syncing your notes.

Jul 8, 2014 9:31 PM in response to dianeoforegon

Well, that basically worked so thank you very much. I had to make a couple of adjustments:


  1. I had to pull the file out of Time Machine from a couple of weeks ago to make sure I had the right version of my Notes. To do this, you need to make sure that you've closed down Notes and turned it off in iCloud.
  2. I had real issues setting up the share folder between my two accounts, and after spending an hour not making it work, I gave up and just moved ~/Library/Containers/com.apple.Notes/ to a flash drive. Once more Apple fails me in simplicity.
  3. Notes opened up in my new Account perfectly, but I couldn't make sync to my iPhone without messing everything up. I just did it the easy way and cut and pasted all of the Notes to a text file, and then cut and pasted that to my blank Notes on the original account.
  4. Turned on iCloud for Notes, everything is synced.


I'm all right with iCloud, it does what it's supposed to do. It does get backed up with Time Machine. And it works 99.99% of the time perfectly with my iPad, iPhone, and iMac. This was a complicated fix because the Notes file got corrupted, and I couldn't figure out how to move the backed up files from Time Machine.

Recovering corrupted notes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.