Sub topic 3
What Caches Are and Why They Exist
Assume you know how to use Finder and System Settings, and that you can open Terminal. A cache is temporary data kept so an app can work faster. It may contain downloaded images, indexes, build files, or package archives. Caches are usually safe to recreate, but they can still occupy substantial space.
Clearing User Caches
User-level caches are stored under ~/Library/Caches. The ~ represents your home folder. Quit the related applications before clearing their caches. First measure the directory:
du -sh ~/Library/CachesYou can remove contents inside this folder when you need space, but leave the Caches folder itself in place. Apps will rebuild needed files. Do not confuse this location with ~/Library/Application Support, which can contain important user data and settings.
Developer and Package Manager Caches
Developer tools often keep larger caches. Examples include build output, simulator data, dependency archives, and compiler indexes. Package managers also retain downloaded packages. Removing them may make the next build or installation slower, but it should not remove your source code.
For Homebrew, preview old downloads and versions before deleting anything:
brew cleanup -nUse the tool’s own cleanup command rather than deleting package-manager directories by hand. This preserves its metadata and avoids confusing future updates.
Time Machine Local Snapshots
When a Time Machine backup disk is unavailable, macOS can keep local snapshots on the startup volume. These snapshots may appear as purgeable space. List them with:
tmutil listlocalsnapshots /macOS can remove snapshots automatically when space is needed. Avoid manually modifying snapshot storage unless you understand the backup consequences.
Checking Results and Keeping Space Free
After cleanup, check the same location again and review overall capacity:
df -h /System/Volumes/DataAllow a few minutes for Storage settings to recalculate. Keep important files backed up, review large folders periodically, and remove only data you can identify.
Exercise
Which command measures your user cache directory, and what should you do before clearing it?
Show answer
Run du -sh ~/Library/Caches, then quit related applications and confirm that the files are temporary cache data.