Added mail index rebuild script

from: http://apple.stackexchange.com/questions/40258/mail-app-5-1-is-unusually-slow
This commit is contained in:
Yan Pritzker 2012-10-13 19:39:07 -07:00
parent bb8ce756d3
commit f1a79bd681

13
bin/rebuild_mail_index.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/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'"'