Don't let Mail attachments accumulate and waste space

Suppose you have an e-mail in Apple Mail (on Mac) with an attachment. Further, suppose for example the attachment is a Word file (.docx). If you double click the attachment it will open in Word for Mac BUT it will also be saved in:

~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads

If you close Word, whether you save the document or not, the file in the Mail Downloads folder does not go away. Further, if you delete the e-mail the file will still be in this folder.

Files just accumulate in the Mail Downloads folder without you knowing itā€™s happening. The only way I have found to deal with this is to open this folder from Finder and manually trash everything there. If you kept the original e-mail it will still have the attachment so nothing is lost.

This is true for macOS up to and including Big Sur. I have not investigated later releases.

Interesting. My Mail Downloads folder has items in it going back to 2013, but takes up only 673MB. I say ā€œonlyā€ not because thatā€™s a trivial size. Of course it would be nice to have that back if those are indeed orphaned attachments (i.e., original email has been deleted). But since 2013 Iā€™m sure I have received tens, if not hundreds of gigabytes of email attachments. So there must be some management of these files going on, no? (MacBook Pro, macOS 13.1)

1 Like

Possibly. I do know that if you use File > Save attachmentsā€¦ in Mail it does not keep a copy in

~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads

Itā€™s also possible that each time you install a new version of macOS (e.g., Catalina > Big Sur) it wipes the downloads folder.

1 Like

I just checked, and that folder contains thousands of items, nearly 12 GB, also dating back to 2013. All that has carried over through numerous system upgrades and migration to a new computer in 2020. (2019 iMac, currently Monterey 12.6.2)

That path does not exist in my Ventura 13.1. What does exist is 5 folders with this path:
~/Library/Containers/Mail/Data/Library/

Only two of them contain
~/Library/Containers/Mail/Data/Library/Mail Downloads/

And one of those is empty. The other one contains 177.3MB of data.

Iā€™ve got 8400+ folders, about 7gb. They date back to May 2015 which is when I got this machine.

What a mess though! Why does Mail put them all in individual folders? It would be so much easier if they were all in one folder (like Eudora did)

Diane

So there is something really strange going on here with the way the Finder displays things. When I navigate to ~/Library/Containers in the Finder, I see SIX folders named ā€œMailā€. But when I open a Terminal window and do:

ls  ~/Library/Containers | grep -i mail

I get

com.apple.MailCacheDelete
com.apple.MailServiceAgent
com.apple.MailShareExtension
com.apple.STMExtension.Mail
com.apple.diagnosticextensions.osx.maillogs
com.apple.mail
com.apple.mail.MailNotificationContentExtension
com.apple.mail.MailQuickLookExtension
com.apple.mail.SpotlightIndexExtension
com.apple.share.Mail.compose
com.apple.share.Mail.compose-back-to-sender

So clearly thereā€™s a whole bunch of stuff going on here that the Finder pretends are all just folders named ā€œMailā€.

Dave

Same here (on Big Sur, and I never use Appleā€™s Mail app). Interestingly, the six ā€œMailā€ folders have different icons:

If I do a ā€œGet Infoā€ on each, one however:

Screen Shot 2022-12-27 at 18.37.41

I can see that they each have different real-world names. The six ā€œMailā€ folders are actually::

  • com.apple.mail
  • com.apple.mail.MailQuickLookExtension
  • com.apple.MailShareExtension
  • com.apple.share.Mail.compose
  • com.apple.share.Mail.compose-back-to-sender
  • com.apple.STMExtension.Mail

GetFileInfo indicates that the C bit (meaning custom icon) is set and all other attributes are off:

$ GetFileInfo com.apple.mail
directory: "/Users/.../Library/Containers/com.apple.mail"
attributes: avbstClinmedz
created: 04/01/2013 18:07:16
modified: 12/14/2022 18:38:03

I donā€™t see any BSD extended attributes:

$ ls -ldO com.apple.mail
drwx------@ 6 ...  staff  - 192 Dec 14 18:38 com.apple.mail/

Iā€™m not sure where the Finder is getting the custom name from. I looked at the two .plist files contained at the root level of each of these folders (using plutil -p filename) but didnā€™t find in there that might contain a different user-visible filename.

Yes, a mess it is.

On Big Sur, I have the six folders Dave6 mentioned, but I also have a Library/Mail/V8 folder (outside of Containers) which is a much bigger problem, literally, with currently 102 GB. I have never understood how to get rid of all the junk in there, despite the fact that I do exactly what fellwalker57 suggested, namely save pretty much all important attachments elsewhere (usually under a new name).

If someone has a suggestion how to save all the attachment files from that Library/Mail/V8 folder (e.g. on an external drive), and then just get rid of the attachments in that folder, that would be super helpful.

For me, /Library/Mail/V8 stores a copy of all the e-mails in my Archive and other folders. I know these are on iCloud but this folder stores a local copy. In my case itā€™s 2Gb which is about right so 102Gb sounds rather large. Does your Mail Archive folder contain so many messages that 102Gb is credible?

Mail does appear to be buggy. In my /Library/Mail/V8 folder I have .mbox folders for all the Mail folders: Drafts, Sent Messages, Deleted Messages, INBOX, etc. all of which are several megabytes even though I have no current e-mails in any of these folders in Mail. I have found that I can delete all the contents of these Library folders without adverse effects.

I do not know of an easy way to verify that all the mail in the V8 folder is the same as the mail you want to keep. On at least 2 occasions I have had to rebuild my Mac from scratch and each time it downloaded a fresh copy of all my emails from iCloud into Mail folders that were initially empty. So that meant I only had the mail I wanted. I donā€™t recommend that as a solution.

Just realized I also have a \Mail\Downloads folder. That has 900 individual items in it from April 2012-June 2013. I think itā€™s from the first email address I migrated over the Mail in 2012 and I wonder if earlier OS versions handled downloads more rationally.

Diane

One thing you need to understand about attachments is that the original is embedded into the message itself. Any that you find in an ā€œAttachmentā€ folder exists only if you chose to view it while reading the message (including images you choose to view) or download it. They are all duplicates of what is already coded into the original message. Those copies are deleted along with the message when deleted. So there is no harm in deleting all those found in ā€œAttachmentā€ folders since they can always be reproduced from the original message if needed. But there isnā€™t any way to automatically move them all to an external drive as they would almost certainly lose their connection to the original message.

So, when you say I can ā€œdelete an attachment and then reproduce it from the original messageā€, you probably mean I can reproduce it from the message on the IMAP mail server, correct? Technically, I want to save my attachments to certain folders and then get rid of the attachments, INCLUDING any copies on servers, so I have only 1 copy of each attachment (not counting backups, obviously).

I have 2 Gmail accounts (one private, one job-related), and both are near capacity (30+ out of 36 GB, I believe), so I really want to delete the attachments on the server too. For some reason, Gmail seems to make this really difficult, at least in bulk.

PS: Mail on High Sierra and probably other MacOS versions had a bug that produced extra copies of Mail attachments, sometimes thousands of copies (no kidding). Apparently a rare bug and only induced with certain Mailbox behaviors activated. I think this is solved now (with changed settings) but I cannot exclude there is some junk from that time still sitting around in my V8 folder.

Of course, you can save an attachment wherever you want. To get rid of the attached copy, choose Message > Remove Attachments.

If you do that, the message will no longer be associated with the file that was originally attached. If you open an old message, you are on your own finding where the attachment went. And, vice versa, the file will have no pointer back to the message it came from.

Hi Jeff,

I certainly use Message > Remove Attachments. In fact, I use it compulsively (in the form of ALT-CMD-A). Depending on the mail account, it may work, but often it doesnā€™t. Must be one of Mailā€™s numerous idiosyncrasies (or inabilities to cooperate with Gmail). I never understood why this isnā€™t a reproducible or even reliable behavior.

If you chose to use Message->Remove Attachments it will remove all embedded attachments from both your local copy and an iCloud IMAP message, but I havenā€™t yet verified that works the same way with a gmail account.

Does a ā€œnuke and paveā€ on your Mac clear the Mail Downloads folder(s) out?

The tool CleanMyMac X (https://macpaw.com/cleanmymac) can remove Mail Attachments.

1 Like

Believe it does but not 100% sure.

No Containers directory on my Catalina system that I can locate. Oh, there it is. Hmm. Thatā€™s a whole of files, dating back several years, back to when I purchased this machine. Looks like it holds 682MB of data. Interestingly, from the command line, I cannot do an ls on the com.apple.mail directory or change to the ā€˜Mail Downloadsā€™ folder.

1 Like