Skip to content

Instantly share code, notes, and snippets.

@phillpafford
Created September 15, 2014 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phillpafford/d5cc49f9913e510abcf9 to your computer and use it in GitHub Desktop.
Save phillpafford/d5cc49f9913e510abcf9 to your computer and use it in GitHub Desktop.
Speed up Mail.app by vacuuming the Envelope Index
(*
Speed up Mail.app by vacuuming the Envelope Index
Code from: http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012 <http://brettterpstra.com>
*)
tell application "Mail" to quit
set sizeBefore to do shell script "ls -lah ~/Library/Mail/V2/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"
do shell script "/usr/bin/sqlite3 ~/Library/Mail/V2/MailData/Envelope\\ Index vacuum"
set sizeAfter to do shell script "ls -lah ~/Library/Mail/V2/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"
tell application "Terminal" to display dialog "Mail index before: " & sizeBefore & return & "Mail index after: " & sizeAfter & return & return & "Enjoy the new speed!"
tell application "Mail" to activate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment