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:
- Quit Mail.app.
- Launch Terminal, then type
cd ~/Library/Mail/. - Back up
Envelope Indexin whatever fashion you prefer. I didcp Envelope\ Index EnvelopeIndexBackup. - Open
Envelope Indexwith SQLite:sqlite3 Envelope\ Index. At thesqlite>prompt, type:vacuum subjects;. Once the prompt returns, type Ctrl-D or.exitto 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.
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
July 29th, 2009 at 3:28 am
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.July 29th, 2009 at 6:48 am
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.
July 29th, 2009 at 8:08 am
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.
July 29th, 2009 at 8:15 am
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 Indexwas in~/Library/Mailfor me. Yes, do let me know if you see a difference after you run your update.July 29th, 2009 at 10:09 pm
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?
August 1st, 2009 at 4:49 am