Site icon ivucica blog

Mini tip on clearing iCloud bookmarks and starting over

I’ve got a backup of my several thousand bookmarks (mostly junk, but who’s got time to dig through it?), but I’ve played a bit with importing and exporting bookmarks from all over the place so the syncing with iCloud never ends. Too many changes!

So, how did I just finish dealing with that?

What follows is error prone, and if followed, may cause data loss. I’m not documenting this for your benefit, but for my own. Consider this a letter to myself in the future. Please don’t follow this unless you yourself know exactly what you’re doing and have three backups of your important data. Everything that has to do with syncing is error prone out of the box, even without a user messing with it.

As previously discussed, iCloud’s bookmark sync actually involves WebDAV and XBEL. It also involves a file containing all bookmarks: ~/Library/Safari/Bookmarks.plist.

So after ruthlessly murdering the SafariDAVClient process (and ensuring it doesn’t wake up until I want it to: watch -n1 killall SafariDAVClient), I opened the aforementioned file. There were over 30000 pending changes. That’s unacceptable.

So I went and deleted all bookmarks using Safari, for convenience. The plist editor I used didn’t allow selection of multiple items, so deleting bookmarks would take a while. I left alone the Reading List, because I didn’t have a proper backup of that. I took note of what the remote folder name of the Reading List was.

Then I mounted the root WebDAV mount point, and went and deleted every folder and bookmark except for the Reading List — thus bringing iCloud into sync with the local dataset.

Then I watched the progress as the changes were applied, and imported the bookmarks several times using a certain tool I use that also reduplicates bookmarks and keeps a copy of bookmarks, etc. I watched the progress by opening Bookmarks.plist and looking at how many changes were in the ./Sync/Changes array.


via blog.vucica.net