Friday, June 21, 2013

Unexpected "Welcome to Mail" on OS X Lion: restoring lost email through two pref files

Emily opened her email 3 days ago and saw "Welcome to Mail".

That's bad. It meant OS X had lost track of her mail archives. The files were all on disk, but the OS knew nothing about them.

I didn't try entering new information of course. That would have been quite disastrous. Instead I poked around and found the usual advice to restore ~/Library/Preferences/com.apple.mail.plist from Time Machine. [1]

That did nothing.

Then I found Power loss, Mail accounts gone,...: Apple Support Communities, a post that recommended also restoring ~/Library/Mail/V2/MailData/Accounts.plist. That looked good, since her current file was 1kb and the old one was 6kb. After a Time Machine restore her email was back.

Of course this doesn't explain why her data was lost in the first place. HFS+ is supposed to be journaled, we should't lose these files even in a nasty crash. So now I have to run some drive diagnostics.

Update: [1]. Oops, i should have read more closely damnit. I think the SuperUser article had the right advice pre-Lion.

/System/Library/PrivateFrameworks/ScreenReader.framework/Versions/A/Resources/English.lproj/ExceptionsDatabases/com.apple.mail.plist
~/Library/Mail/MailAccounts.plist
~/Library/Preferences/com.apple.mail.plist

Personally I wouldn't mess with /System unless the other two fail and the directory changed post Lion.

No comments: