A faster Mail.app for OSX - vacuuming the Envelope Index sqlite database

I have a love/hate relationship with Apple’s Mail.app. It’s pretty and powerful and has good rule based filters, ok junk mail detection and good support for imap, pop and even Exchange accounts.

However, at times I have to say I’m looking longingly at other mail clients, in particular Thunderbird (so don’t even get me started on the fact I should already be back on Ubuntu… I’m looking for a good laptop before moving back.).

Anyhow, we’ve been experimenting with a new mail system at work and I’ve noticed that Mail has been having quite a bit of trouble. Slow loading, slow display and just generally dog running. A look at this hint on Hawk Wings (dead link) really did the trick though.

I was absolutely stunned at the difference in speed after I ran the following 2 commands in a terminal and waiting for them to finish.

sqlite3 ~/Library/Mail/Envelope\ Index vacuum index
sqlite3 ~/Library/Mail/Envelope\ Index vacuum subjects

Besides generally reducing the size of the Envelope Index file, the vacuuming of the sqlite database that indexes the mbox files that make up your mail causes an amazing speed-up in the app (YMMV).

Mail loads up noticeably quicker and loading up individual messages is near instantaneous as opposed to the several seconds I was waiting on some messages before.