I Cleared 128GB of Junk Files from my MacBook
My MacBook Pro was running out of storage. Its 256GB of memory was down to 9GB of free space.
I ran About This Mac > Storage > Manage> Optimize Storage. I ran Clean My Mac. These cleared a few gigabytes, but the space was soon filled again.
I noticed that the folder sizes didn’t add up. My user account had 6.5GB of files but used 152GB of storage.
Then I keyed shift-command-period. This shows hidden files. The 152GB of hidden files became visible.
I found that the Apple Podcast app had stored 6GB of old podcasts. I listen to podcasts on my phone, never on my MacBook. I trashed that file.
Updating some programs leaves the old versions. There were 25 versions of MongoDB, totaling 10GB. I haven’t used MongoDB since 2015. I trashed that folder.
In Microsoft Outlook I deleted 35,000 old spam emails. Moving an email to “Deleted Items” doesn’t delete the email. You then have to delete the emails in the “Deleted Items” folder. This saved 4GB.
I had 4GB of “Messages.” Every picture texted to or from my phone somehow was stored on my MacBook. I have no idea why. Someone could make an app that shows you each picture and you click up or down to save or delete it. That would clear 4GB in a hurry.
I stopped after clearing 40GB. I could have cleared more but as the files get smaller it takes more time to clear a gigabyte.
A Better Way
Those 40GB were eaten up within a few months. Then I found a better way to clear garbage files.
- Use Time Machine to backup your internal SSD to an external SSD or HDD.
- Use Disk Utility to erase your internal SSD.
- Restart with command-r to bring up Recovery Mode.
- Restore OS X to your SSD.
- Use Time Machine to restore your data and apps.
This cleared half my SSD (128 GB)! It’s easy and fast if you buy an external SSD. An external 240GB SSD is under $30 and is more than enough space to back up a 256 GB SSD.
Then I tried this on my 2009 Mac Pro running El Capitan. (I have two legacy apps that run in OS X, not macOS.) The hard drive had 1.77 TB of data and the Time Machine backup was 1.75 TB. No junk files there. This implies that Big Sur or an app running on my MacBook is spewing out junk files. Maybe Microsoft Outlook?
A few months later the 256GB internal SSD was nearly full again, with just 12GB free. I did the Time Machine backup procedure again. This time something went wrong and Disk Utility couldn’t erase, restore, or even read the internal SSD. After hours of in a very bad mood I was able to bring the SSD back online using the network system restore. From there it was straightforward to restore the internal SSD from the Time Machine backup on an external HDD. I’d made a second Time Machine backup on another external SSD as a backup to the backup.
The result? 232GB used dropped to 127GB used.
While I was at it I reformatted the SSD as APFS without case sensitivity. I’d always assumed the case sensitive file names are a good thing, right? I remember when MS-DOS filenames were all UPPERCAS.TXT (eight letters maximum). Then in 1984 the Macintosh came out and you could use upper- and lower-case letters in file names, and anything length you wanted. This was cool.
But I googled this yesterday and read that case sensitive means that you have two file in the same folder with the same name! Some apps won’t work with case-sensitive APFS. So I reformatted the SSD to fix this.
I looked through the reformatted SSD and only saw one item missing: a 48 GB sync backup of my iPhone. I sync my phone to my Mac Pro (with four internal hard bays), not to my MacBook so I’m happy that Time Machine trashed those files. I don’t know what else it got rid of.
Restore Back Better
There may be a safer way to do this. Apple has two docs about this.
- Restore your Mac from a backup says to use Migration Assistant.
- Use Disk Utility to erase an Intel-based Mac says to use Disk Utility from network recovery mode.
Putting this two docs together suggests starting in network recovery mode, using Disk Utility to erase the internal SSD, and then using Migration Assistant to restore your files from Time Machine.