Speed up Mail.app

In these times of effectively unlimited quotas, there’s no need to ever delete email. And I don’t—all my various accounts’ inboxes combined add up to somewhere around 20,000 emails. Having all your emails is great, but accessing them quickly is at least as important as having them on hand. However, of late, I’d been experiencing some severe performance problems in Mail.app—it was taking literally on the order of minutes for Mail to start up and shut down for me. Just brutal.

Today, in an effort to alleviate some of that pain, I stumbled across a solution that worked magnificently for me: cleaning up Mail.app’s SQLite database.

Here’s how you do it:

  1. Quit Mail.app.
  2. Launch Terminal, then type cd ~/Library/Mail/.
  3. Back up Envelope Index in whatever fashion you prefer. I did cp Envelope\ Index EnvelopeIndexBackup.
  4. Open Envelope Index with SQLite: sqlite3 Envelope\ Index. At the sqlite> prompt, type: vacuum subjects;. Once the prompt returns, type Ctrl-D or .exit to quit SQLite.

This reduces the size of Mail.app’s database and cleans it up, usually to dramatic effect. I reduced my database from ~34 MB to ~22 MB, and Mail now starts up in seconds, not minutes. Boom!

References: procedure and information about the vacuum statement.

6 responses to “Speed up Mail.app”:

  • John Bastin said:

    I took a look at this when I saw this current reference to it (I had read the original posts, but since they were a couple of years old, I didn’t think things would still be the same).

    I did a cd to ~/Library/Mail and there was no Envelope Index to be found. I did a locate for Envelope Index and the only one I found was in a Mail folder in the backup of my office PowerMac G5 that I keep on my laptop.

    I’m running Mail 3.6 (935/935.3) in Mac OS X 10.5.7. There are three POP accounts.

    Any thoughts?

    John Bastin
    bastinj@gmail.com

    MacBook Pro 2.4GHz (17-inch)
    4 GB RAM
    320GB HDD
    Mac OS X 10.5.7

  • Richa said:

    Are you sure you’re looking in ~/Library/Mail? That’s the Library folder in your home directory, not at the root of the filesystem; /Users/yourname/Library/Mail, not /Library/Mail.

  • John Bastin said:

    What I said in my message was:

    “I did a cd to ~/Library/Mail ”

    That’s the Mail folder in my home directory.

  • John Bastin said:

    Never mind. I’m now re-installing a Combo Update for another problem; let me see what develops on that before I come back to his issue.

  • Richa said:

    Right, just wanted to make sure. Just to remove any complicating factors, I created a new POP account for a new user on a machine that had a fresh Leopard install (rather than my other laptop, which had been upgraded from Tiger). Envelope Index was in ~/Library/Mail for me. Yes, do let me know if you see a difference after you run your update.

  • John Bastin said:

    After doing the re-install and house cleaning, everything seems to be in place. Looking back, it’s possible I wasn’t looking where I thought I was looking. Anyway, now I did do the “vacuum” operation and was able to take an 11MB Envelope Index down to about 8.5MB.

    The effect? Not really noticeable. My mail didn’t seem slow before, and I don’t notice any change. Of course, my Envelope Index didn’t seem nearly as large as some I’ve read about in this thread and others. But I keep very little mail in my Inbox, it all gets filtered off to other folders as soon as it arrives. Maybe this has an effect?

Leave a reply

(required)
(required) (will not be published)