RR

Apple Address Book, Exchange, Leopard, iSync and You

March 6, 2007

Originally posted to ydnar.vox.com in March 2007.

I’m a contacts packrat. My phone(s), Macs, Windows boxen and everything else is synced with the Exchange server at work. This weekend I installed Leopard to test some Vox code on my MacBook Pro. Aside from the numerous bugs, everything was pretty much hunky-dory. Settings, email, contacts, calendar entries, it all worked [1].

Fast-forward to this morning. I’m writing an email to someone at work and notice that Mail.app is not autocompleting the address. Odd, I thought. Later, when it refuses to autocomplete someone else, I open Address Book and notice that every single contact I had (a few hundred) is gone. In its place is a pair of entries for Apple, Inc. and myself.

Cue OMFGZ.

I check phone. All contacts still there. Check ActiveSync settings: Make sure conflicts prefer the data on the phone. Set phone down and go to Outlook Web Access. All contacts gone. My Mac had synced and destroyed the server’s record of any contact I had. Dismayed I checked my phone again. It had synced. Now my MacBook, the Exchange server, and my phone all had the same shitty 4 contacts: Me and Apple. Cue 2nd round of OMFGZ.

I remembered the MacBook Pro at home. Maybe it still had a copy of my contacts list in Address Book.app. I SSHed home, and tried to ping the MBP. No luck, it had gone to sleep and wasn’t on the network. I decided to cut bait and go home to try to recover the data manually.

I stepped into my apartment, hit the “Internet” button on the cable modem, and went upstairs to the loft. The MBP was asleep as I’d figured. As quickly as I could, I woke it, entered my password and hit the Airport menu and disabled WiFi. Just to be sure. I then dug into the ~/Library/Application Support/AddressBook directory and noticed a number of files that were not present on my Tiger machine’s. There were also a lot of files with the word “corrupt” in the filename. The AddressBook.data.previous file was, miraculously still big (several MB). I copied the directory to a tarball, a DMG, and a duplicate folder, and queued an email of it to myself on two different servers.

I crossed my fingers and opened Address Book. Crash. Again, crash. Then OS X asked me if I wanted to revert the settings and try again. Crash. OMFGZ, round 3!

So I tried nuking every file in the Address Book data directory that looked like a generated/dependent file, and moved the AddressBook.data.previous to AddressBook.data. Address Book started! All of my contacts were there, and iSync started complaining about conflicts. I resolved those, and disabled the machine from ever syncing with Exchange again.

I backed up the Address Book, and then emailed that file to myself, copied it to another machine and generally didn’t waste time getting the precious data off this (cursed) machine. When I got back to the office, I was able to import the backup file. Crisis averted.

Lesson? Back up your OS X Address Book. There’s even a command for it in the File menu. Maybe something in there about trusting all your eggs to the unholy mix of Exchange and iSync. Anyways.

[1] Dear Apple: Please make Leopard iCal talk to Exchange. OS X Calendar Server is a nice idea, but nobody is going to install it.