JP Chen

How to Clean Your Mac in 10 Minutes Without Installing or Paying for Third Party Apps

Disclosure: This writing is a result of my own findings. It also assumes basic command-line knowledge. Use at your own risk. Last updated: 01/2017

See What is Taking Up Space

Hard Disk

If your breakdown is dominated by media files, you can comb through your personal videos and pictures and back up/delete them as necessary. Most likely, the “Other” Category will be the largest consumer of your available disk space. OSX lumps files, caches, hidden files, and system files all under “Other”. If you have enormous personal projects or media archives, then you should take care of that yourself (and you probably wouldn’t be here right now). This guide is on cleaning up system or hidden files that most users typically ignore or aren’t aware of.

How to Clean ‘Other’ Files

Diagnosis

To see what files are eating up most of your space, you’ll need to scan your disk.

> brew install coreutils

(If you don’t have Homebrew it’s highly recommended, but if you really don’t want to install it, you can change the command below to sort -n though it will make your life slightly harder).

Run this command:

(for d in *; do; du -hs $d; done) | gsort -h

This will recursively go through all the files and folders in your current directory and aggregate a list of their sizes. This is essentially what all third party apps do when they scan your disk. Because it parses your entire directory tree, running this in your root directory may take a long time. I’ve found it’s more useful to run it in places I know take up a lot of space but want the breakdown for (/Library, /Applications, or ~/Dropbox).

Libraries

The worst thing you can do is to be slightly too trigger-happy with rm -rf and spend the rest of the night mulling over your bad life decisions.

The (generally) largest but safer things to remove are Library files. There are 3 types of Libraries: /Library System/Library and ~/Library. Very broadly, /Library is accessible by everyone, /System/Library is used by the system, and ~/Library is used by the user. There are a lot of repetition and unneeded files here and between all of them you can probably clear up 10G depending on how long ago you last cleaned your Mac.

Libraries

You can do the same thing with your /System/Library if you still need room. Generally I don’t like to mess with system files so if you do, just don’t delete anything that affect core services.

Cleaning your Cache

Cached files are the major recurring factor for what will eat up your space. Application Support is the next closest if you install and heavily use applications between clean sessions. Your caches live in ~/Library/Caches/ and you will want to go in there and clean out some stuff. My Mac is kind of small, so I set a monthly cron job to clean this up. Each application has its own set of caches, but in general, they are pretty safe to delete, especially if you are desperate for space.

Cleaning Up Unneeded Apps

Apps take up an enormous amount of space but oftentimes, this is inevitable. If you want to use Chrome and Spotify, you have to put up with the space it takes up on your computer. However, you can clean out apps you don’t use or ones that come with your Mac. Contrary to some popular belief online, you can delete Mac native apps (eg iMovie, GarageBand), but you will need root access to do it. If you run the above command in the /Applications directory, you can see which apps hog the most space and sudo rm -rf the ones you do not use.

Your job is not done yet! Once you clean out your junk apps, you need to delete its Supporting Files, User Data, and Logs. These are the files that the app uses on startup, but live elsewhere on your filesystem. Your app may have none, some, or all of the following.

First, go to ~/Library/Application\ Support/ and delete the corresponding directory for your app. The Application State can be found in ~/Library/Saved\ Application\ State and usually is formatted com.[company].[product].savedState. Most likely you have a few of these, so go ahead and clean those up. Logs are located in ~/Library/Logs so find and delete your app’s logs. Finally, if you missed it earlier, make sure you delete the existing cache for your apps.

Long-term Solutions

Nope

If cleaning your Mac was not enjoyable and fulfilling for you, you can consider one of a ton of disk cleaning apps. Otherwise, invest in an external hard drive where you can dump your things and not keep your files on your internal hard drive. There are also cloud-based options such as iCloud, Dropbox, and Google Drive, which offers the obvious convenience of being able to access all your things without your computer, but charge recurring fees. It’s really a personal preference.

If I missed anything in my haste, please let me know! Hope this was helpful to at least someone out there.


Share this: