MacAppKit Guides

How to clear Xcode and other developer caches on a Mac

Developer machines fill up quietly. Xcode, simulators, package managers and old project folders can hold tens of gigabytes, and most of it can be regenerated. The trick is knowing which part is rebuildable and which is not.

Disclosure: Sweepvault is made by the MacAppKit team, who publish this site, so weigh our view accordingly.

The usual suspects, and the built-in way to clear them

WhatWhereSafe to remove?
Xcode DerivedData~/Library/Developer/Xcode/DerivedDataYes. Xcode rebuilds it; the next build is slower
Simulator runtimes and devicesXcode > Settings > Platforms; xcrun simctl delete unavailableYes, but runtimes must be re-downloaded if needed
iOS DeviceSupport~/Library/Developer/Xcode/iOS DeviceSupportUsually; Xcode re-creates it when you reconnect a device, which takes time
ArchivesXcode > Window > OrganizerOnly if you no longer need those builds; they hold your submitted binaries and symbols
Package cachesfor example npm cache, ~/.gradle/caches, ~/.cargo/registry, HomebrewYes, they download again; use the tool's own command where there is one, such as brew cleanup
Project build foldersnode_modules, Rust target, Swift .build, Python virtual environmentsYes in old projects; reinstall when you return to them

To find the weight first, run du -sh ~/Library/Developer/* 2>/dev/null. Quit Xcode before deleting anything in its folders. The in-Xcode command Product > Clean Build Folder only cleans the current project, so it does not clear the whole DerivedData directory.

Doing it with Sweepvault

  1. Run Smart Scan. Developer data appears under Developer junk (Xcode build data, device support, archives), Package and model caches (Homebrew, pip, Cargo, Go, Maven, Hugging Face, conda and others) and Old project build folders (node_modules, Rust target, Swift .build, Python venvs).
  2. Open Cleanup and read the labels. Xcode DerivedData, simulator caches, the documentation cache, SwiftUI preview data and device logs are marked safe and are deleted, since Xcode recreates them. Device support files and archives are marked for review and go to the undo vault if you remove them. Package caches and project build folders are marked for review and not pre-selected, because you may not want to redownload everything.
  3. Tick what you want to clear, press Clean, and watch the progress. Anything that went to the vault can be restored from the Recovery tab within 30 days.
  4. The Space tab shows a map, which helps find a build folder in a project you forgot.
SweepvaultPreview developer junk before it goes; 30-day undo vault
See Sweepvault Download the DMG

Limits

A sensible routine

Once a month, run a scan, clear DerivedData and old build folders, and clean package caches only when you need the space. Keep recent archives. Our general guide to a full Mac covers the non-developer parts.

Why not just delete ~/Library/Developer?

Because it is not all cache. The folder also holds things you may want: archives of builds you shipped, device support files that take a long time to fetch again, and in some setups simulator devices with test data inside them. Deleting the whole folder is a blunt move that is hard to reverse. Clearing the rebuildable parts first, one at a time, usually frees most of the space for much less risk. After clearing, open your project, let Xcode re-index, and confirm a clean build works before moving on to the next folder.

Sweepvault facts, as listed on its page: macOS 14 Sonoma or later, Apple silicon and Intel, no account. Cleaning, the 30-day undo vault, the large and duplicate file finder, the space map and clean uninstall are free. Pro adds file recovery and Time Machine search: $12.99 a year or $29.99 once for up to 3 Macs, with a 7-day trial in the app; purchases are final.