Sonoma upgrade -- Mail crashes trying to upgrade mail database

On my iMac 27" I was upgrading OS from Mojave to Sonoma 14.2.1. Everything was fine until I tried to open mail. System said "upgrading email database" and it chugged away, then crashed about 2/3 of the way through. Tried several more times, restarted, tried again. Same result every time. Upgraded my MacBook Pro a few months back to 14.1.1, no problem that time. Any advice? What should I do next, other than do email on my laptop? :)

iMac 27″, macOS 14.2

Posted on Dec 31, 2023 10:21 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 29, 2024 1:35 PM

I went through four weeks of back-and-forth with Apple Support on this. We pretty rapidly established that Mail itself would launch when it wasn't trying to upgrade my old mail from the prior laptop, like on a new account starting from scratch. At one point they suggested a similar approach to @dmxyy_, specifically:


mv ~/Library/Mail/V10 ~/Library/Mail/V10.old 
sudo -v ; killall -9 accountsd com.apple.iCloudHelper ; defaults delete MobileMeAccounts ; mkdir ~/Library/Accounts/Backup ; mv ~/Library/Accounts/*.sqlite* ~/Library/Accounts/Backup/ ; killall -9 accountsd com.apple.iCloudHelper ; sudo reboot


Moving the V10 folder out of the way in this way allowed Mail to launch, as I described in my earlier comment in this thread. The resulting launch of Mail had all of my accounts, but with the inboxes, etc., empty, and also the routing rules from Settings > Rules all disabled. Asking Mail to Get New Mail prompted me for my IMAP passwords and would then successfully bring in anything that was still on the IMAP servers. However, it didn't have any of the On My Mac folders, which had all been stored in ~/Library/Mail/V10


Ultimately, I used Mail > Import Mailboxes... to manually import each of the roughly dozen folders inside that relocated V10 folder as Apple Mail format -- most had hexadecimal names like 5D23B670-2D69-4E3A-C97F-CDDD8E3082EA, but there was also one called Exchange IMAP-myemail@mail.server.com and even an old RSS feed folder that I forgot that Mail was ever used for. The folder named MailData had configurations but no mail in it to import.


This appears to have imported all my On My Mac mail. It also made a duplicate copy of all the messages currently on the IMAP servers locally in folders On My Mac, and some of the On My Mac folders were imported multiple times, but they're pretty well sorted and isolated from each other and won't be a problem for me to delete when I'm feeling confident.


As far as I can tell this process brought in meta-data like read/unread status or message coloring. I went through each of my top-level folders and confirmed that the unread message counts matched with the old computer running Mojave and also spot-checked the entire message count for a handful to check that they matched. In some cases it sorted the mailbox folders in different orders or dropped folders that didn't actually have any messages in them so it sometimes looked like lost data but ultimately I found everything that I spot checked. I feel quite confident this process got everything I care about, and am reasonably confident it actually got everything altogether.


I'd've preferred not to have to go through all this and definitely considered just moving all my mail up to the cloud somewhere, but it's done now.

LJT_Malden wrote:

On my iMac 27" I was upgrading OS from Mojave to Sonoma 14.2.1. Everything was fine until I tried to open mail. System said "upgrading email database" and it chugged away, then crashed about 2/3 of the way through. Tried several more times, restarted, tried again. Same result every time. Upgraded my MacBook Pro a few months back to 14.1.1, no problem that time. Any advice? What should I do next, other than do email on my laptop? :)


10 replies
Question marked as Top-ranking reply

Feb 29, 2024 1:35 PM in response to LJT_Malden

I went through four weeks of back-and-forth with Apple Support on this. We pretty rapidly established that Mail itself would launch when it wasn't trying to upgrade my old mail from the prior laptop, like on a new account starting from scratch. At one point they suggested a similar approach to @dmxyy_, specifically:


mv ~/Library/Mail/V10 ~/Library/Mail/V10.old 
sudo -v ; killall -9 accountsd com.apple.iCloudHelper ; defaults delete MobileMeAccounts ; mkdir ~/Library/Accounts/Backup ; mv ~/Library/Accounts/*.sqlite* ~/Library/Accounts/Backup/ ; killall -9 accountsd com.apple.iCloudHelper ; sudo reboot


Moving the V10 folder out of the way in this way allowed Mail to launch, as I described in my earlier comment in this thread. The resulting launch of Mail had all of my accounts, but with the inboxes, etc., empty, and also the routing rules from Settings > Rules all disabled. Asking Mail to Get New Mail prompted me for my IMAP passwords and would then successfully bring in anything that was still on the IMAP servers. However, it didn't have any of the On My Mac folders, which had all been stored in ~/Library/Mail/V10


Ultimately, I used Mail > Import Mailboxes... to manually import each of the roughly dozen folders inside that relocated V10 folder as Apple Mail format -- most had hexadecimal names like 5D23B670-2D69-4E3A-C97F-CDDD8E3082EA, but there was also one called Exchange IMAP-myemail@mail.server.com and even an old RSS feed folder that I forgot that Mail was ever used for. The folder named MailData had configurations but no mail in it to import.


This appears to have imported all my On My Mac mail. It also made a duplicate copy of all the messages currently on the IMAP servers locally in folders On My Mac, and some of the On My Mac folders were imported multiple times, but they're pretty well sorted and isolated from each other and won't be a problem for me to delete when I'm feeling confident.


As far as I can tell this process brought in meta-data like read/unread status or message coloring. I went through each of my top-level folders and confirmed that the unread message counts matched with the old computer running Mojave and also spot-checked the entire message count for a handful to check that they matched. In some cases it sorted the mailbox folders in different orders or dropped folders that didn't actually have any messages in them so it sometimes looked like lost data but ultimately I found everything that I spot checked. I feel quite confident this process got everything I care about, and am reasonably confident it actually got everything altogether.


I'd've preferred not to have to go through all this and definitely considered just moving all my mail up to the cloud somewhere, but it's done now.

LJT_Malden wrote:

On my iMac 27" I was upgrading OS from Mojave to Sonoma 14.2.1. Everything was fine until I tried to open mail. System said "upgrading email database" and it chugged away, then crashed about 2/3 of the way through. Tried several more times, restarted, tried again. Same result every time. Upgraded my MacBook Pro a few months back to 14.1.1, no problem that time. Any advice? What should I do next, other than do email on my laptop? :)


Jan 28, 2024 12:47 PM in response to coolgeo56

coolgeo56 wrote:

So Apple, are you going to comment on this?

This is a user-to-user technical support forum. Apple doesn't directly participate.

What you are doing to fix it or how we can perform fixes?

I'm not doing anything to fix it. Normally I make recommendations for ways to avoid these kinds of problems, but people rarely listen.

Is there another thread we should be watching?

I haven't seen any other threads about this problem. But when I search, this thread seems like a good one: Apple Mail crashes after OS 14 Sonoma upgrade


However, based on what you've already said:

I restored the iCloud email folders and emails, but not my other provider folders and their emails. I get new mail to that account but none of my old folders with their emails reappeared. Any ideas/solutions?

the solution in that thread probably won't work.


Double-check your e-mail using web-based clients, if you have them. Try to find out if your old e-mail still exists on their server. If it does, you could maybe try to download it again. You could setup a new user account on your Mac and try to sign in to your existing e-mail account as if you were setting up a new account. You can also try another e-mail client like Thunderbird and see if you can pull those folders that way. Either way, what you want to do is extract those e-mails into "mbox" files which can be easily re-imported back into Apple Mail.

I have lost an enormous amounts of stored data on thousands of emails that has compromised my business. Your attention to this important matter would be grateful.

If you depend on your Mac for your business, then you probably shouldn't be applying upgrades like this. I realize you probably don't want to hear this after the fact. Also, sometimes Apple will forcibly upgrade your computer against your wishes. (It recently happened to me.)


But regardless, if you depend on your Mac for your livelihood, then you'll need to take additional precautions, make additional backups, and maybe even have a backup computer ready to go. Back when I was unceremoniously dumped into Sonoma, I was so grateful to have had my new 2023 MacBook Air that I could use while rebuilding my main system. Of course, that new computer only runs Ventura, which I consider to still be beta-quality. But it was good enough to prevent a complete disaster.


I also archive all of my e-mail into yearly "mbox" files. By "archive" I mean I create an "On my Mac" mailbox and copy all of the previous year's e-mails into that mailbox and then export the mailbox to an "mbox" file. I can re-import that into my new computer (or my rebuilt, old computer) and lose only a small fraction of messages.

Apr 3, 2024 3:52 AM in response to LJT_Malden

I had this issue too after upgrading from Ventura to Sonoma and since I didn't want to loose any local mailboxes or local copies, like when tampering with V10 mailboxes, i spent a some time to see if I could make it work with all data. All I had to do is to delete the three "Envelope Index" files from V10\Maildata. Next time you open Mail, it does not show the crashing "Upgrading your Mail Library..." window, but it shows something like "Mail is importing mailboxes....", shows email count & progress and most importantly - does not crash, imports all active email accounts and all mailboxes in "On my mac" - and the Mail app starts working like it did before.

Jan 1, 2024 5:36 AM in response to LJT_Malden

It seems like the upgrade to Sonoma 14.2.1 on your iMac 27" is causing Mail to crash during the mail database upgrade process. This is a known issue with the Sonoma update, and Apple is working on a fix. In the meantime, there are a few things you can try to resolve the issue:

  1. Start in Safe Mode: Safe mode disables third-party extensions and login items, which can sometimes interfere with Mail's operation. To start in Safe Mode, hold down the Shift key while restarting your Mac. If Mail opens without crashing in Safe Mode, then the issue is likely caused by a third-party application. You can then identify and remove the problematic extension or login item.
  2. Rebuild the Mail Database: If the issue persists even in Safe Mode, you may need to rebuild the Mail database.This can be done by following these steps:
    • Close Mail.
    • Open Finder and navigate to ~/Library/Mail.
    • Locate the V10 folder and move it to your desktop.
    • Open the PersistenceInfo.plist file in TextEdit.
    • Change all occurrences of V10 to V2.
    • Save the file and close TextEdit.
    • Relaunch Mail.
    • Mail will rebuild the database.
  1. Contact Apple Support: If none of these solutions work, you should contact Apple Support for further assistance.They may be able to provide more specific troubleshooting steps or offer a temporary workaround until a permanent fix is released.

In the meantime, you can access your email on your MacBook Pro, or you can use alternative email clients like Thunderbird or Outlook on your iMac.

Jan 22, 2024 10:03 AM in response to dmxyy_

Sadly, this workaround did not work for me. I note there were no occurrences of V10 in the plist file even though there was a V10 folder for me to move, which surprised me. After performing the steps, Mail went through a very rapid import step and then started with almost none of my Mail messages or configuration converted.


This came about from upgrading to a new machine. I'm wishing I'd kept a copy of PersistenceInfo.plist on my new machine before trying (I still have it on the old machine). Since this seems to be a pretty known issue, I think my workaround might be just using Mail on my old machine until the next Sonoma point release.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sonoma upgrade -- Mail crashes trying to upgrade mail database

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.