Have you been frustrated by Mac OS X Mail.app crashing or hanging? This happens to me from time to time, even though I keep OS X updated to the latest version. Well, I found a fix that works for me anyway, and you might try it.
Besides the strange bugs that seem to have plagued Mail.app on Apple OS X from time to time over the last several generations of OS X, and, the matter of Gmail’s non-standard IMAP implementation, I’ve found something that seems to work for me, when Mail.app starts showing the spinner, indicating a hang or crash.
How to Fix a Hung or Crashed Mail.appScreenshot: OS X Lion Mail Import
I’ve found that deleting Mail.app’s “envelope” index seems to alleviate crashing or hanging.
I suspect what happens is, a malformed email message is received, and Mail.app hangs on processing that. I’ve found that one can delete recent messages one by one, sometimes, and this fixes the problem. But other times, just selecting the faulty message will cause a crash, so you need to take measures to fix that.
To delete your “envelope” index: first, shut down Mail.app, using Force Quit if needed. Then, at the Terminal:
cd ~/Library/Mail/V2/MailData rm -rf Envelope\ Index* rm -rf ExternalUpdates.storedata*
N.b.: substitute V3 for V2 on OS X El Capitan, or V4 on macOS Sierra.
Finally, restart Mail.app and it will show a dialog box, similar to the vintage one shown above. It takes a few minutes, but Mail will rebuild the envelope index, and this generally fixes the problems I have had.
What if it does not work?
You can also try:
- Shut down Mail, delete all the locally stored mail, by deleting the IMAP folders in
.../V3), and restart Mail. It will re-download all your emails in those accounts.
- Remove and restore the accounts themselves.
To delete the IMAP folders and all your downloaded mail, the command would be something like:
cd ~/Library/Mail/V2 rm -rf IMAP*
You can make that re-download process go much faster by setting each account to not download attachments. N.b., this is in Mail, Preferences, Accounts (select account), Advanced, uncheck “Automatically Download All Attachments”.
I hope this information helps someone with their Mac OS X Mail.app troubles. Enjoy!