Mail started repeatedly crashing immediately on my Mac starting it today - about a week after installing OS X 10.9 Mavericks.
Typing in Terminal "defaults delete com.apple.mail ColorQuoterColorList" did not work.
I figured out how to get mail running again with the following:
I think there are several issues that conspired to cause the crashes:
1. Mail changed how it handles GMail accounts causing all of the mail from GMail to be downloaded and duplicated into separate folders depending on the label assigned to the email. In GMail, each email can have several labels. But in Mail, these labels are NOW treated as separate folders - which is how traditional email programs handle this problem. Thus Mail places a duplicate of each email into a folder corresponding to each label.
-> This change forces Mail to repeatedly and heavily re-index the email.
2. Mail has to re-index the thousands of emails in some user's Macs. On my computer, I did not realize that I had over 140,000 pieces of email I had saved through the years. Many people have more. This is over 25% of all the files in the Mac!
-> Unfortunately, doing this re-indexing on the fly while people are reorganizing and manipulating their email can lead to corruption of the contents of the MacintoshHD:Users:YourName:Library:Mail:V2 folder where each email account's data is stored.
-> Interestingly, Mail has to do a lot of the Operating System's work - indexing, reorganizing, labeling files, etc. With some people having over 400,000 emails, this is a lot of work. And it is prone to failure since the Mac OS uses the HFS+ file system which isn't the most robust file system.
3. While Mail is re-indexing and re-organizing the email, OS X 10.9 is also updating the Spotlight index on the fly.
-> These competing file requests can cause the file system to be overloaded, possibly leading to Mail crashing.
The steps to get mail running again are the following:
0. Make a backup of your Mail folder: MacintoshHD:Users:YourName:Library:Mail
1. Open the System Preferences > Internet Accounts Preference Panel. And INACTIVATE every email account by un-checking "Mail" or "Enable This Account" for each email account.
-> This stops the heavy and repeated re-indexing of email. This allows Mail to restart without crashing.
2. Go to each GMail Account you have. Go to Settings > Labels and set "All Mail" to "show".
-> This stops the duplication of emails by Mail. This reduces Mail's re-indexing and reorganization work.
3. If you do not need the emails stored in GMail, erase all of them in Gmail. Go to each of your online email accounts and erase what you don't need.
-> This reduces the indexing that Mail has to do with GMail and other EMail accounts.
4. Go to MacintoshHD:Users:YourName:Library:Mail:V2 and erase the contents of each GMail account's folder and any other account's folder you want to start fresh.
6. Open the System Preferences > Internet Accounts Preference Panel. Then ONE-BY-ONE Activate each email account. Check that Mail can start and remain stable after activating each account.
7. If any account causes Mail to crash, inactivate it. Erase its MacintoshHD:Users:YourName:Library:Mail:V2 account folder countent. Then try to reactivate it.
-> AVOID moving or deleting large numbers of emails during this process. Mail is indexing and organizing the emails so you don't want it to make and error which leads to a crash.
-> You can tell Mail or the File System is working heavily to index the email by using a utility such as iStat Menus which can monitor the CPU usage. Of course, the fan spinning loudly is a clue.
8. Once the indexing is complete, Mail is once again stable.
In the near future, I want to reduce the workload of Mail by archiving the email into DEVONThink Pro Office or Email Archiver or similar program. There, the email can still be organized, searched for, etc. But it will no longer be a burden on Mail to organize. Any email to archive will simply be transferred.
Another lesson learned is that I wouldn't want 300,000+ emails stored in Gmail like some people. Mail will download all of these, taking up a lot of disk space and work to index and organize. Since privacy is a problem with Google, it makes far more sense to offload the email into your Mac, where it can be kept private, and easily searched offline.