How to clear Xcode and developer caches on a Mac
On a developer’s Mac, the largest users of disk space are often build caches and tool downloads, not documents. Most of them rebuild automatically. The table below shows where each one lives, whether it is safe to delete, and the command that clears it.
Xcode
| Folder | What it is | Safe to delete? |
|---|---|---|
~/Library/Developer/Xcode/DerivedData | Build products, indexes and logs for every project you have opened | Yes. Xcode rebuilds it on the next build, which will be slower once. |
~/Library/Developer/Xcode/iOS DeviceSupport (and watchOS, tvOS) | Debug symbols for each OS version of devices you have connected | Yes for old OS versions. Xcode copies them again when you connect a device. |
~/Library/Developer/Xcode/Archives | App builds you archived for distribution, with their dSYMs | Keep the ones you still need for crash reports. Delete old ones in Xcode’s Organizer. |
~/Library/Developer/CoreSimulator/Devices | Simulator devices and the apps and data inside them | Delete unavailable ones with xcrun simctl delete unavailable. Data inside a deleted simulator is lost. |
~/Library/Developer/CoreSimulator/Caches | Simulator runtime caches | Yes. |
You can also remove simulator runtimes you no longer use in Xcode › Settings › Components. Old Xcode installers (Xcode_*.xip) in Downloads often take several gigabytes each.
Package managers and toolchains
| Tool | Command to clear | Notes |
|---|---|---|
| Homebrew | brew cleanup | Removes old versions and cached downloads from ~/Library/Caches/Homebrew. |
| npm | npm cache clean --force | Cache in ~/.npm. Packages download again when needed. |
| pnpm | pnpm store prune | Removes packages no project references. |
| Yarn | yarn cache clean | Clears the global cache. |
| CocoaPods | pod cache clean --all | Cache in ~/Library/Caches/CocoaPods. |
| pip | pip cache purge | Cache in ~/Library/Caches/pip. |
| Go | go clean -cache | Build cache in ~/Library/Caches/go-build. |
| Playwright | Delete old browser folders | Browsers in ~/Library/Caches/ms-playwright. Reinstall with npx playwright install. |
Docker
Docker Desktop keeps all images, containers and volumes in one disk image, Docker.raw, inside ~/Library/Containers/com.docker.docker. Run docker system prune to remove stopped containers, unused networks and dangling images. Add -a to remove all unused images, and --volumes only if you are sure you don’t need the data.
Docker.raw is a sparse file: Finder may report 64 GB while it occupies far less on disk. SpareDisk shows both sizes, so you can see what deleting it would actually free.
Editors and AI coding tools
VS Code, Cursor and JetBrains IDEs keep caches in your Library, and extensions can store a lot in VS Code’s global storage. AI coding assistants that keep task histories and checkpoints can grow very large. One SpareDisk user found Cline using 176 GB. Clear histories from inside the tool when you can.
Old projects
Old projects hold node_modules folders, build and .build directories, virtual environments and Rust target folders. All of them can be regenerated. Deleting them from projects you no longer work on is safe as long as the source code is kept.
Do it all in one place with SpareDisk
SpareDisk’s Developer screen measures all of these under your home folder without asking for any extra permission: Xcode DerivedData, device support and archives, simulators, Homebrew, npm, pnpm, Yarn, CocoaPods, pip, Go, Playwright, JetBrains, VS Code, Cursor and Docker. Each entry says which tool rebuilds it. Add Rebuildable to Review queues the safe ones, and nothing moves until you confirm.