Question
On checking SSD disk on my MacBook Pro I noticed that ~50 GB free space has disappeared without any notification in the past few months. I did not install any new applications or big data, and already removed temporary files and caches, and cleared ~/Download folder and Trash. Safari, Mail, Adobe PhotoShop and Final Cut are extensively used. I heard that Mail cannot work well with Google mail servers and it may store tons of cache files. Deleted files and attachments are not removed from local storage etc. I have a couple of gmail accounts and some mails with large attachments. I am using IMAP google accounts and Mac Mail 8.2 on Yosemite 10.10.3. Is the source of the mess is the Mail? How to clean it up?
Solution
Chances are high you will find a lot of files you don’t need any longer, especially the old and deleted ones, and trashing them will free up some very valuable SSD space.
1. Backup your system. It’s not a joke. You can easily delete some very important folders and files you will desperately need. We assume good computer and OS expertise. If you do not understand what hidden files, Terminal window or commands are, call an expert.
2. Take a look at your disk usage. Menu bar Apple -> About this Mac -> Storage tab. There is nothing to do here.
3. If you find the disk usage strange, check out what’s going on. Try to identify big folders and files. Open Finder. Navigate to the system drive (Macintosh HD by default). Select Arrange -> Size.
Apple hides files and folders to prevent us from accidentally changing or deleting important data. If you don’t know how to see these hidden folders, launch Terminal window and run:
Later you can switch it off by running the same commands with changing TRUE to FALSE.
4. Look for the Mail folders in the Finder
In the Mac Mail, if there is any, remove all messages from the Trash folder. Quit Mail. With the Finder navigate to ~/Library/Mail/V2 folder and find your IMAP-xxxx@imap.gmail.com local stores. In the storage tree inspect subfolders of Deleted Messages and Trash (.mbox) that tend to store emails demanding gigabytes of disk space. Go inside those containers, identify and delete obsolete data (ie. folders and files). Do not worry, likely you do not mess up your mac. Those subfolders can be seen as “cache” of your emails and will be rebuilt by Mail if something important is missing.
If you have old and misconfigured IMAP settings on the gmail server, you might easily find tens of gigabytes of obsolete files here. Apple can’t always figure out what Google is doing. One bad sign is that deleted messages temporarily reappear in the Mail’s Archive folder.
5. Adjust your gmail account(s)
You might need to adjust your gmail settings to not show the messages in multiple IMAP folders and ‘expunge’ the message when the Mac Mail requests it. In the web browser, open your gmail.com account and select Settings -> Forwarding and IMAP. Check these: Enable IMAP, Auto-Expunge off – Wait for the client to update the server, Immediately delete the message forever, and save changes:
Go to Settings -> Labels. Check Show in IMAP checkbox for Inbox, Sent Mail and Spam. Uncheck Show in IMAP. Note that this might make a lot of of email, that has no other labels, hidden for Mail. Do not follow these steps blindly. Adjust them to your own requirements.
Open Mail on your Mac. Check out Mail Preferences -> Accounts -> Mailbox Behaviors tab and uncheck checkboxes of Store xxxx messages on the server where applicable – for example in the Junk and Trash group.
6. Remove old Mail Download files
In the Finder navigate to the Mail Downloads folder (~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads), or open Spotlight Search and type in Mail Downloads. The folder will show up. Double click it.
From this folder remove old files and folders you do not need any longer.
killall Finder