The safe way to clear developer caches on a Mac is to use each tool's own clean-up command, with the tool quit. Xcode DerivedData, iOS DeviceSupport for old iOS versions, Homebrew downloads, and npm, Yarn, pnpm, pip and conda caches can all be deleted and are rebuilt when needed. Simulators, Docker and archives need more care: remove them through Xcode, simctl and Docker's own commands, never by dragging their folders to the Trash.
The table below lists every place, then each tool gets its own short section. Measure first, delete second.
du -sh.Developer caches at a glance
| What | Where | How big it gets | Safe to delete? | Command or place |
|---|---|---|---|---|
| Xcode DerivedData | ~/Library/Developer/Xcode/DerivedData | Grows with every project you build | Yes, rebuilt | Quit Xcode, then rm -rf ~/Library/Developer/Xcode/DerivedData/* |
| iOS DeviceSupport | ~/Library/Developer/Xcode/iOS DeviceSupport | One folder per iOS version you've debugged on | Yes, for versions you no longer use | Delete old version folders in Finder |
| Xcode Archives | ~/Library/Developer/Xcode/Archives | One per build you archived | Only for builds you'll never need to debug | Xcode's Organizer window |
| Simulator runtimes | Managed by Xcode | Several GB each | Yes, ones you don't test on | Xcode › Settings › Components |
| Simulator devices | ~/Library/Developer/CoreSimulator/Devices | Grows with apps and data on each one | Unavailable ones, yes | xcrun simctl delete unavailable |
| Homebrew downloads | brew --cache shows it | Old bottles and installers pile up | Yes | brew cleanup |
| npm cache | ~/.npm | Every package you ever installed | Yes | npm cache clean --force |
| Yarn cache | yarn cache dir shows it | Every package you ever installed | Yes | yarn cache clean |
| pnpm store | pnpm store path shows it | Shared by all projects | Unused packages, yes | pnpm store prune |
node_modules | Inside each project | One full copy of the dependencies in every project | Yes, in projects you aren't working on | Delete the folder; reinstall later |
| Docker Desktop | One disk image file | Up to the limit you set | Unused images, containers and build cache, yes | docker system prune |
| pip cache | ~/Library/Caches/pip | Wheels you've downloaded | Yes | python3 -m pip cache purge |
| conda packages | conda's pkgs folder | Every package version downloaded | Unused ones, yes | conda clean --all |
| Gradle caches | ~/.gradle/caches | Dependencies and build caches | Yes, with no build running | gradle --stop, then delete |
| Android emulators | ~/.android/avd | Very large disk images | Ones you don't use, yes | Android Studio Device Manager |
Save or screenshot this table. Before deleting anything, see how big it is: du -sh ~/Library/Developer/* or du -sh ~/.npm ~/.gradle.
Xcode
Quit Xcode before you delete anything in ~/Library/Developer. An Apple engineer on the developer forums puts it simply: make sure Xcode is quit before you delete files behind its back.
DerivedData
DerivedData holds build products, indexes and module caches for every project you open. On Apple's developer forums, the accepted answer says you can delete it at any time and it grows back as you load and build projects. The cost is a slower first build and a fresh index.
rm -rf ~/Library/Developer/Xcode/DerivedData/*
At WWDC26, Apple confirmed that Xcode 27 adds a Delete Derived Data menu item, so newer Xcode versions can do this without Terminal.
iOS DeviceSupport
Each time you debug on a real iPhone or iPad running a new iOS version, Xcode copies support files into a folder named for that version. The forum's accepted answer says you can delete any versions that don't match devices you still debug on. If you plug in that device again, Xcode copies them back.
Archives
Each archive holds a built app and its debug symbols (dSYM files). Apple uses those symbols to turn crash reports into readable code. Keep archives for any version people still use. Delete older ones in Xcode's Organizer (choose Window › Organizer), or move them to another disk.
Simulator runtimes
A simulator runtime is a whole copy of iOS, watchOS, tvOS or visionOS for the simulator. Apple's documentation says to choose Xcode › Settings, click Components, then click the Info button next to a component and choose Delete. Xcode shows how much space each one frees.
From Terminal, xcrun simctl runtime list lists them and xcrun simctl runtime delete followed by an identifier removes one. Developers on Apple's forums report that a deleted runtime sometimes comes back, so check in Components afterwards.
Simulator devices
Each simulated device keeps its own apps and data. xcrun simctl delete unavailable removes devices your current Xcode can no longer run, often left behind by old Xcode versions. To remove others, use Window › Devices and Simulators in Xcode. An Apple engineer advises managing CoreSimulator through that window or simctl rather than deleting its folders yourself.
Homebrew
brew cleanup removes old versions of installed packages and downloads more than 120 days old. Add -n first to see what it would remove. brew cleanup --prune=all removes every cached download. Installed packages are not touched.
JavaScript: npm, Yarn, pnpm and node_modules
- npm: the cache lives in
~/.npm. npm calls it self-healing, so it says the only reason to clear it is to get disk space back. That is whynpm cache clean --forceneeds--force. - Yarn:
yarn cache clean. In Yarn 2 and later, add--mirrorto clear the shared global cache, or--allfor both.yarn cache dirshows where Yarn 1 keeps its cache. - pnpm:
pnpm store pruneremoves packages no project uses. pnpm says it is "not harmful" to run now and then. On a Mac the store is usually~/Library/pnpm/store;pnpm store pathtells you for sure. node_modules: rebuilt frompackage.jsonand the lockfile whenever you install. To find them, runfind ~/Projects -name node_modules -type d -prune(use your own projects folder). Delete them in projects you aren't working on. Keep the lockfile.
Docker Desktop
Docker's documentation says Docker Desktop stores all Linux containers and images in one large disk image file. Its location is shown in Docker Desktop under Settings › Resources › Advanced; by default it is under ~/Library/Containers/com.docker.docker.
- See what uses the space:
docker system df -v. - Remove stopped containers, unused networks, dangling images and build cache:
docker system prune. Add-ato also remove every image no container uses. - Be careful with
--volumes. Volumes can hold real data, such as a local database.
Docker warns not to move the disk image in Finder, because Docker Desktop can lose track of it. Use Disk image location in the same settings to move it to a bigger drive. Lowering the disk size limit there deletes the image file, and with it every container and image.
Python: pip and conda
pip keeps its cache in ~/Library/Caches/pip on a Mac. python3 -m pip cache info shows its size and python3 -m pip cache purge empties it.
For conda, conda clean --all removes the index cache, unused packages, tarballs and temporary files. Don't add --force-pkgs-dirs: conda warns it can break environments.
Gradle and Android
Gradle keeps its caches in ~/.gradle/caches and cleans them itself. Its documentation says unused version-specific caches are deleted after 30 days, and unused downloaded files after 30 days. To clear them now, stop the daemons with gradle --stop (or ./gradlew --stop in a project), then delete ~/.gradle/caches. The next build downloads what it needs.
Android emulators are stored in ~/.android/avd, and Google says they are mostly very large disk images. Delete ones you don't use in Android Studio's Device Manager: click Menu next to a device and choose Delete. To remove system images and SDK packages, open Tools › SDK Manager and clear their checkboxes. The SDK itself is usually in ~/Library/Android/sdk.
What not to delete
- Archives you still need to read crash reports.
- Docker volumes holding data you haven't backed up.
- Lockfiles, such as
package-lock.json,yarn.lockorpnpm-lock.yaml. - CoreSimulator folders and Docker's disk image, when deleted by hand. Use Xcode,
simctland Docker instead. - Anything while its tool is running.
Let a tool find them
If you'd rather not run every command, CloudRoomy's Free Up Space (we make it) looks for most of these in one scan: Xcode DerivedData and device support, iOS simulators not used in 60 days, Android emulators not run in 60 days, Docker images no container uses, node_modules in projects not changed for 30 days, and package caches for npm, Yarn, pnpm, Bun, pip, Gradle, CocoaPods, Cargo, Playwright, Go and Homebrew downloads. It lists everything with its size and deletes nothing until you confirm. Xcode archives older than 14 days are moved to your CloudRoomy drive with a link left behind, rather than deleted. It leaves Docker's disk image, Android SDK system images and simulator runtimes alone.
CloudRoomy needs a Mac with Apple silicon and macOS 26.2 or later, and is free for 30 days with 50 GB. For the rest of the disk, see what is in System Data, and how to offload big apps you rarely open.
Questions people ask
Is it safe to delete Xcode DerivedData?
Yes. On Apple's developer forums the accepted answer says you can delete DerivedData at any time and it grows back as you build. Quit Xcode first. Your next build is a full one, so it takes longer.
How do I delete old iOS simulators?
Remove runtimes in Xcode › Settings › Components: click the Info button next to a runtime, then Delete. Run xcrun simctl delete unavailable to remove simulator devices your Xcode can no longer use.
Does npm cache clean free space?
Yes, but it needs --force: npm cache clean --force. npm says the cache is self-healing, so the only reason to clear it is to get disk space back. Packages download again when you next install.
Why doesn't Docker Desktop give space back when I delete files?
Docker Desktop keeps everything in one disk image file. Docker says space is freed when images are deleted, not when files are deleted inside running containers. Use docker system df to see usage, then docker system prune.
Can I delete node_modules?
Yes, in projects you aren't working on. It is rebuilt from package.json and the lockfile when you run npm install, yarn or pnpm install. Never delete a project's lockfile along with it.
Sources, checked 17 November 2026: Apple, Downloading and installing additional Xcode components; Apple Developer Forums, Xcode using 90GB with ~/Library/Developer: what can I safely clean?; Apple, Xcode Tips and Tricks Group Lab, WWDC26; Apple, Understanding Crashes and Crash Logs, WWDC18; Homebrew, brew manual page; npm, npm cache; Yarn, yarn cache clean and Yarn 1 cache; pnpm, pnpm store and store settings; Docker, Docker Desktop for Mac FAQs and docker system prune; pip, Caching and pip cache; conda, conda clean; Gradle, Gradle-managed directories and caches; Android Developers, Create and manage virtual devices, Environment variables and Update the IDE and SDK tools.
Found a command that has changed? Write to hello@cloudroomy.app.