everyday mac tools

Mail is taking up storage on a Mac: attachments and the envelope index

· 6 min read

Mail keeps a local copy of every message in your accounts, attachments included, in ~/Library/Mail. On an account that has been running for years, that folder is often several gigabytes and occasionally tens of them.

Most of the weight is attachments you will never open again, plus a search index that grows with use and does not shrink when you delete mail. You can cut both, but the order matters and one of the steps deletes mail from the server as well as from the Mac, so read that part before you run it.

Find out how big it actually is

Two commands settle it. Open Terminal and run:

  1. du -sh ~/Library/Mail for the total.
  2. du -sh ~/Library/Mail/V*/* to see it split by account.

The V folder is a version number that changes with macOS releases, so on your Mac it may read V9, V10 or something else. If you have more than one version folder, the older ones are leftovers from a previous macOS and they are usually dead weight, though it is worth confirming Mail opens normally before you remove one.

System Settings, General, Storage also lists Mail as its own category. That figure is calculated in the background and lags behind reality, so treat it as a rough reading rather than a scoreboard while you work.

There is a second location. Mail is sandboxed, so some of its data lives in a container. Find the part that matters with:

find ~/Library/Containers/com.apple.mail -type d -name "Mail Downloads"

That folder holds copies of attachments you opened or previewed. It is a cache, it regenerates, and on a heavy mail user it can be surprisingly large.

What is actually inside the Mail folder

Knowing the shape makes the rest of this obvious.

  • One folder per account, named with a long identifier rather than the address. Match them by size, not by name.
  • .mbox folders, one per mailbox, containing individual messages as .emlx files. An attachment is either embedded in the message file or sits in an Attachments folder beside it.
  • A MailData folder containing the Envelope Index: an SQLite database holding every message header and the full-text search index, with -wal and -shm companion files. Rules, signatures and account settings live in MailData too, which is why it is not a folder to clear out wholesale.

The Envelope Index is the part that confuses people. Deleting ten thousand messages marks space inside that database as free but does not hand it back to the disk, so the file stays roughly as large as the largest it has ever been until it is rebuilt. That is normal database behavior, not a fault.

Stop Mail downloading every attachment

This is the change that keeps the folder from growing back, and it deletes nothing.

  1. Open Mail, then Settings (Preferences on older macOS versions).
  2. Go to Accounts and select an IMAP or Exchange account.
  3. On the Account Information tab, find Download Attachments and set it to Recent or None.

With None, message text still syncs and stays searchable; the attachment is fetched when you open the message. The trade is that you need a connection to open an old attachment, which is fine on a desktop and a judgment call on a laptop you use offline.

Set this on every account. It applies going forward only, so it will not shrink anything today.

One exception that matters: if an account is POP rather than IMAP, the Mac holds the only copy of that mail. Nothing in this article that deletes messages should be applied to a POP account without a backup you have checked.

Clear the mailboxes that only hold things you already deleted

Trash and Junk are frequently the largest mailboxes on the Mac, because the default is to keep them for a long time or forever.

  1. Mailbox, Erase Deleted Items, In All Accounts.
  2. Mailbox, Erase Junk Mail.
  3. Then Mail, Settings, Accounts, Mailbox Behaviors, and set Trash and Junk to erase after a week or a month instead of never.

Be clear about what this does on IMAP and Exchange: the mailbox is on the server, so erasing it on the Mac erases it everywhere, including on your phone. That is usually what you want for Junk and for mail you deleted months ago. It is not reversible from the Mac.

Find the heavy messages instead of guessing

Rather than scrolling, let Mail assemble the list.

  1. Mailbox, New Smart Mailbox.
  2. Set the condition Message Size is greater than 10 MB, and add Contains attachments if you want to narrow it further.
  3. Tick the options to include messages from Trash and Sent, then save it.

Sent is where most people find the surprise: outgoing mail with large files attached, kept forever, in an account nobody thinks of as storage.

For a message whose text you want to keep, select it and use Message, Remove Attachments. It strips the file and leaves the email. On an IMAP account this rewrites the message on the server too, so save the attachment somewhere first if there is any chance you will want it. Finding a Mail attachment on a Mac covers digging one out before it goes.

If you are looking at something inside ~/Library/Mail and cannot tell whether it regenerates, that is what Ask Crumb in Crumb is for: point it at an item and it explains what the item is, whether it comes back, and what stops working without it, then proposes a plan you approve before anything is removed. That feature is part of the $9 purchase; the read-only audit of System Data is free, and worth running first to confirm Mail is your largest item. What System Data is on a Mac covers the rest of that number.

Rebuild the index when you have finished

Rebuilding is the step that finally shrinks the Envelope Index, and it should be last.

Select a mailbox and choose Mailbox, Rebuild. Mail discards its local cache for that mailbox and pulls it back from the server. On a large mailbox this takes a while and uses real bandwidth, so leave Mail open until it settles.

Rebuild is only safe where the server has the messages. On a POP account there is nothing to rebuild from, so leave it alone.

What not to do

Do not delete .emlx files in Finder. The index will still list them and Mail will behave strangely for weeks.

Do not empty MailData. Your rules, signatures and smart mailbox definitions are in there.

Do not judge the result in the first ten minutes. Between the storage figure lagging and macOS holding freed blocks as purgeable, the number can take a restart and an hour to reflect what you did. Purgeable space on a Mac explains why.

Questions

Will deleting mail on the Mac delete it from the server? On IMAP and Exchange accounts, yes. Those mailboxes are the server’s, and the Mac is showing you a copy. On a POP account, no, and the Mac may hold the only copy in existence.

Why did the folder barely shrink after I deleted thousands of messages? Two reasons. The Envelope Index keeps its size until it is rebuilt, and macOS may be holding the freed blocks as purgeable rather than free. Rebuild, restart, then measure again.

Is it worth deleting the Mail Downloads folder in the container? Yes, if it is large. It holds copies of attachments you opened, it is not the only copy of anything that is still in your mail, and it fills again as you use Mail.