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

FolderWhat it isSafe to delete?
~/Library/Developer/Xcode/DerivedDataBuild products, indexes and logs for every project you have openedYes. 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 connectedYes for old OS versions. Xcode copies them again when you connect a device.
~/Library/Developer/Xcode/ArchivesApp builds you archived for distribution, with their dSYMsKeep the ones you still need for crash reports. Delete old ones in Xcode’s Organizer.
~/Library/Developer/CoreSimulator/DevicesSimulator devices and the apps and data inside themDelete unavailable ones with xcrun simctl delete unavailable. Data inside a deleted simulator is lost.
~/Library/Developer/CoreSimulator/CachesSimulator runtime cachesYes.

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

ToolCommand to clearNotes
Homebrewbrew cleanupRemoves old versions and cached downloads from ~/Library/Caches/Homebrew.
npmnpm cache clean --forceCache in ~/.npm. Packages download again when needed.
pnpmpnpm store pruneRemoves packages no project references.
Yarnyarn cache cleanClears the global cache.
CocoaPodspod cache clean --allCache in ~/Library/Caches/CocoaPods.
pippip cache purgeCache in ~/Library/Caches/pip.
Gogo clean -cacheBuild cache in ~/Library/Caches/go-build.
PlaywrightDelete old browser foldersBrowsers 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.

Questions

Is it safe to delete Xcode DerivedData?
Yes. DerivedData holds build products and indexes that Xcode regenerates. The next build of each project takes longer, and nothing in your source code is affected.
Is it safe to delete iOS DeviceSupport?
Yes, especially for OS versions you no longer test on. Xcode copies the symbols again the next time you connect a device running that version.
How do I delete old iOS simulators?
Run xcrun simctl delete unavailable in Terminal to remove simulators for runtimes that are no longer installed, and remove unused runtimes in Xcode › Settings › Components. Apps and data inside a deleted simulator are lost.
Why is Docker using so much space on my Mac?
Docker Desktop stores images, containers and volumes in a single Docker.raw disk image. Run docker system prune to remove unused data. Because the file is sparse, its logical size can be much larger than the space it actually uses.