MacBook – Mail.app 5.1 is unusually slow

macbook promail.app

My Mail.app program is ridiculously slow. I have several email accounts and I just checked the size of my Mail folder (~/Library/Mail): 593.2MB.

That's huge…no wonder it's so slow. So the question is, how do I minimize the size? I refer back to old emails all the time, so I am reluctant to just purge my email folder. I have thousands of emails.

Is there an easy way to make this smaller and will that help with the speed of this program?

I have a MacBook Pro 2.5G GHz Intel Core 2 Duo with 4 GB 667 Mhz DDR2 SDRAM. I am running Lion 10.7.2.

Best Answer

You might try the following:

  • Quit Mail first

  • Run the following command in Terminal:

    sqlite3 ~/Library/Mail/V2/MailData/Envelope\ Index vacuum;

This will rebuild your Mail index data.

Below is the actual shell script that I use. I keep it in ~/Library/Scripts/Applications/Mail so it is accessible from the AppleScript menu in Mail.app

#!/usr/bin/env bash

mail_data_dir="/Users/$USER/Library/Mail/V2/MailData"
killall -HUP Mail
BEFORE=`ls -lah $mail_data_dir | grep -E 'Envelope Index$' | awk '{ print $5 }'`
/usr/bin/sqlite3 $mail_data_dir/Envelope\ Index 'PRAGMA integrity_check';
/usr/bin/sqlite3 $mail_data_dir/Envelope\ Index vacuum;
AFTER=`ls -lah $mail_data_dir | grep -E 'Envelope Index$' | awk '{ print $5}'`
echo "before: $BEFORE"
echo "after:  $AFTER"
open -a "Mail.app"
/usr/bin/osascript -e 'tell application "Mail" to display dialog "Envelope Index before: " & "'$BEFORE'" & return & "Envelope Index after: " & "'$AFTER'"'

When run it will automatically quit Mail. Run the command to rebuild and check the integrity of your Mail index data, restart Mail and present a dialog box showing you the before and after sizes of your Mail index file.