Torsten Curdt’s weblog

Optimizing Mail.app index

Some while ago someone posted an AppleScript to optimize the Mail.app index. I prefer bash over AppleScript. So I just dump my version here:

killall Mail
BEFORE=`ls -lah ~/Library/Mail | grep -E 'Envelope Index$' | awk '{ print $5 }'`
sqlite3 ~/Library/Mail/'Envelope Index' vacuum
AFTER=`ls -lah ~/Library/Mail | grep -E 'Envelope Index$' | awk '{ print $5}'`
echo "before: $BEFORE"
echo "after:  $AFTER"

For more details see this blog post or hawk wings.

  • @Mariano: Thanks! Fixed!
  • Hey Torsten,

    good tip. Works well for me.

    There seems to be a minor typo in your script. When you assign the original size to $BEFORE you missed the trailing E in the variable name.

blog comments powered by Disqus