Claim back disk space from (Gmail)

There is a good chance you read your mail from Gmail with Mac’s native Mail app. There is also a good chance you never really paid attention to how much disk space all this content synced with Gmail IMAP really takes up. Having recently replaced my internal 160 GB hard drive with an Intel X25-M SSD drive half the size, I’m naturally eager to strip all the unnecessary stuff out of the system in order to save some SSD space. So how to free a few gigabytes of space from Gmail?

This question has long been lingering around, it’s just that I didn’t care about it when I still had disk space to throw away: Why does ~/Library/Mail/IMAP-marknanut[…] folder take up almost triple the size (some 7 GB) of the amount of actual mail being shown in my Gmail web account (some 2.5 GB)? Gmail messages seem to take up too much space when used with (or any other client that uses IMAP, really). Right click on the “IMAP-youraccountname” folder and select Get Info to see its size:



Ok, this isn’t that hard to find out and goes roughly like this: Gmail’s tags are not exactly compatible with IMAP’s folder logic, thus being displayed as folders in IMAP. In very rough terms: a mail with multiple tags, say 2 or 3 tags, gets locally copied to the same number of folders with these tag names (2 or 3 folders). If you do a Spotlight search in Mail, you’ll usually get duplicate results – for instance the same received mail message appears in “All Mail”, “Inbox”, also “Starred” and so on, whereas a sent message appears in “Sent Mail” and “Sent”.


It would obviously be best to prevent from downloading folders where there are most certainly mail duplicates. You’ll figure it best for yourself, but for a start we can eliminate the “All Mail” folder. So how to do it?

Inspired by the post of Rajiv Pant, I went to my Gmail settings, and under Labs section I enabled “Advanced IMAP controls”.


Next uncheck all tags (folder) you don’t want to download locally (for instance “All Mail”) in the Labels section.


I also unchecked “Starred” and “Spam”. I restarted, and voila – no All Mail, Starred and Spam folders, no duplicates and more than 4 GB extra space.



Which IMAP folders you’ll prevent from downloading, is of course up to you to figure out. I wish you success. Check out Rajiv Pant’s post too. 

CC BY-NC-SA 4.0 Claim back disk space from (Gmail) by 桔子小窝 is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.