How to decrease Mail folder size?

Posted:
in macOS edited January 2014
Trying to backup my .Mail files to iDisk and it says that the directory is 157MB. I've poked through things and can't figure out why it's so large. Any ideas how to fix this?



Thanks,

Chas

Comments

  • Reply 1 of 2
    Make sure that you empty your deleted folders. Otherwise all your deleted mail is still kicking around in your Trash folders.
  • Reply 2 of 2
    zozo Posts: 3,117member
    http://www.macosxhints.com/article.p...426&query=mail



    Quote:

    I was recently clearing out space from my hard drive and noticed that my Inbox in my mail folder had grown quite large, around 80 MB or so. mail told me that I only had about 7 MB of messages, so I wanted to figure out what was taking up all that extra space.



    I went into ~/Library/mail and found the offending mailbox, INBOX.imapinbox (the inbox for my .Mac account). Selecting "Show Package Contents" from the contextual menu showed me that the file inside the inbox that was taking up the most room was mbox.SKIndex, weighing in at a hefty 70.8 MB.



    This appeared to be the file that mail stores its index information for each mailbox. To test my theory, I quit mail, moved the mbox.SKIndex (along with another file called mbox.SKIndex.isValid) out of the mailbox package and onto my desktop, and then relaunched mail. Sure enough, mail started reindexing the inbox to replace the missing index. When it was done, I went and looked in the mailbox package, and there was a new index file, but it was only 576 KB!



    The lesson is that it appears that mail does not flush out old index data from messages that have been removed from a mailbox, so the file just keeps getting larger and larger. So, if you want a quick way to reduce your mailbox sizes (especially boxes that see a lot of traffic), this is a very nice solution.



    The Finder won't let you do a search inside the mailbox bundles for the index files, but you can search from them from the command line using the find command. Make sure you quit mail, then cd into your mail folder by typing cd ~/Library/mail. To find all the index files in all your mailboxes, type:

    % find . -name "mbox.SKindex*" -print



    This will print out the paths of all the files that you'll want to delete. You can also conveniently delete them using find:

    % find . -name "mbox.SKindex*" -delete



    This will clear out the indexes for all your mailboxes. You can then relaunch mail and click on each individual mailbox to start it reindexing.



    [robg adds: Testing this on my machine, I freed up 100mb of drive space. Do a Get Info on the mail folder before and after to see the effects. You can also do this within mail, I believe, by using the Rebuild mailbox option, but then you have to do one mailbox at a time.]



    There are also some reader comments at the link you may want to look at
Sign In or Register to comment.