You can make a difference in the Apple Support Community!

When you sign up with your Apple ID, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How do I completely reset Mail.app to avoid "Out of Application Memory" errors

(some context, I have been professionally writing mac applications since 1993)


This forum locks your thread after a while so this post is to reply to a previous post since I now know the answer for macOS Monterey 12.3


The issue has not been able to be solved by any of the helpful suggestions on my first post. Nor was it solved by 4 hour-long calls from AppleCare.


Briefly: I upgraded to a M1 iMac 24", Mail starts to crash, the "Out of Application Memory" started to come up. Upgrade was made using Migration Assistant with a TimeMachine backup from a disk.



Annoying UI fact: the Out of Application Memory dialog shows you a list of running apps and how much memory they are using takes a while to come up and the app that is causing the issue (Mail) had already crashed and so was not on this list.


Turns out Mail was inexplicably making copies of all my email in "On My Mac" folders, and that was what was causing it to run out of application ram. They were all in folders called Import-1, Import-2 etc. This copying process seemed to use crazy amounts of ram > 10Gb and each time it did it was gradually filling my drive which meant less space to use for virtual memory and so more crashing.


My original post How do I completely reset Mail.app? - Apple Community which you can see some more of the things I discovred and things I tried that didn't work.


I will post what I did next



Posted on Apr 6, 2022 7:46 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 6, 2022 8:00 PM

To get out of this cycle of crashing what I first did is make a copy of the ~/Library/Mail folder onto an external harddrive. Then to prove my method was going to work I made a new account on the same mac (could have been another) and logged into that. Started mail added my gmail account, watched the download all the mail and folders. I had about 150K emails on my gmail account, took a few minutes to sync my inbox and fetch most of my mail. Then using the Mail->File->Import command browsed to the folder where I'd copied the Library/Mail folder to and selected the mailboxes there to import. That took about 20 minutes. When I was done check everything worked, all my mail and attachments were there, most importantly no weird copying process when I started Mail and no crashing.


Now how to get my original login account to this happy state.

  1. Log back into my original account
  2. Turn off iCloud syncing if you have it on
  3. delete ~/Library/Mail
  4. Start Mail, comes up as if it's your first time running it
  5. Go through the procedure above
  6. Fixed
  7. Turn iCloud back on if you use that
  8. Fixed, there is no step 9 ;-)


Hope that helps someome!

Similar questions

1 reply
Question marked as Top-ranking reply

Apr 6, 2022 8:00 PM in response to jrb_retain

To get out of this cycle of crashing what I first did is make a copy of the ~/Library/Mail folder onto an external harddrive. Then to prove my method was going to work I made a new account on the same mac (could have been another) and logged into that. Started mail added my gmail account, watched the download all the mail and folders. I had about 150K emails on my gmail account, took a few minutes to sync my inbox and fetch most of my mail. Then using the Mail->File->Import command browsed to the folder where I'd copied the Library/Mail folder to and selected the mailboxes there to import. That took about 20 minutes. When I was done check everything worked, all my mail and attachments were there, most importantly no weird copying process when I started Mail and no crashing.


Now how to get my original login account to this happy state.

  1. Log back into my original account
  2. Turn off iCloud syncing if you have it on
  3. delete ~/Library/Mail
  4. Start Mail, comes up as if it's your first time running it
  5. Go through the procedure above
  6. Fixed
  7. Turn iCloud back on if you use that
  8. Fixed, there is no step 9 ;-)


Hope that helps someome!

How do I completely reset Mail.app to avoid "Out of Application Memory" errors

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