Q: How to keep Mail from losing accounts after crashing? A: See inside

in Genius Bar edited January 2014
I've been doing a bit of tech support for my family lately, and ran into one that really threw me for a loop for a while, so I thought I'd share the solution with you all.

It seems that Mail crashing on some HTML messages is a common occurrence. (http://www.macworld.com/weblogs/maco...mail/index.php) The solution posted there works *great*... as long as you didn't open the message in its own window, like my brother did. Now the window content is grabbed even when Shift is held down. Oopsie.

So I had him send me the prefs file (~/Library/Preference/com.apple.mail.plist) and I deleted the info that told it to open the single message window on launch. Send it back.

Crash. He hits "Reopen" in the new 10.4 Crash dialog, and it crashes again.

So he hits "Try Again".

Now, this isn't really obvious to many people, apparently, and it seems Apple needs to tweak that dialog, because what happens is that all your prefs go bye-bye on the next launch, to make sure the app has a clean slate. What's not obvious is that this is temporary if you want it, and when you quit the application normally, it'll ask you if you want to go with your old prefs or the new ones. A lot of people are re-entering all their prefs from scratch, only to find that dialog at quit, which is a waste of time.

This issue is made worse with Mail, because in that prefs file is *all your account info*. All the servers, passwords, everything. Seemingly gone. Panic ensues. Your mail is still on the disk, but access to the servers is missing. Oopsie. When you get the 'Please configure your accounts', there is no 'normal quit' option. It just bails if you say 'Cancel'. So you never get the option of saving your old prefs. They just went poof.

He launches Mail, and... 'Please configure your accounts'. I send him the prefs file again. 'Please configure your accounts'. This goes on a couple of times, and he's in a bit of a dither.

So, instead of trying to figure out how to re-enter all the info for the *nine* accounts he has (it's a work thing, and Mail actually made his life much much easier than it used to be), I looked for a way to force Mail to use the old prefs file since there wasn't anything *wrong* with the prefs file that I could see. plutil -lint checked it out as okay, the data looked right, the offending message viewer had been deleted... so why wasn't it working?

Two reasons.

1) When CrashReporter notices an app crashing for the second time, it adds the tag ApplicationCrashedAfterRelaunch to the *application's* preferences file. This is slick, because what it means is that when the preferences engine embedded in the OS sees this, it caches the prefs file, and tells the app that there wasn't one. The app makes a new, fresh, default prefs file. On quit, you get the option of putting the old one back, or using the new one. All done behind the scenes, very slick.

So, open the preferences file in Property List Editor (from the developer tools CD,) delete that tag, save the file, and the application will use the preferences file just fine.

Or so I thought.

2) Mail stores its preferences file as a *binary* property list. It was my understanding that any app could use either a binary *or* an XML *or* an ASCII property list file, but apparently that isn't always the case. Drop to the Terminal, and use the plutil tool to convert the XML plist file to a binary one, and use *that*.

Voila. Works like a charm.

Now, this all would have been impossible if he hadn't sent me the prefs file in the first place, so if you're having a crashing issue with Mail, *copy that prefs file first* before ever saying "Try Again"! This seems to be an issue unique to Mail, but given how much pure-techie info there is in the accounts info that most people aren't comfortable with in the first place, this seems like a really bad place for this to happen.
Sign In or Register to comment.