DevCleaner
Menu
Skip to content
Browse guides

Mac dev disk space cheat sheet

A short list of the folders that usually fill a developer Mac, with the exact path, a command to measure it, a safe way to clean it, and what to leave alone.

On this page

These paths are the macOS defaults. If you moved DerivedData, the Android SDK, or a package cache in the tool's settings, use that location instead. Size ranges below are typical examples, not a promise of how much space you will get back. Quit the app that owns the folder before you delete anything, and prefer moving a folder to Trash over rm -rf when you want a chance to undo it.

Measure the usual suspects first:

du -sh ~/Library/Developer 2>/dev/null
du -sh ~/Library/Developer/Xcode/DerivedData 2>/dev/null
du -sh ~/Library/Developer/CoreSimulator/Devices 2>/dev/null
du -sh ~/.gradle/caches ~/.npm ~/.cocoapods ~/Library/Caches/Homebrew 2>/dev/null

Safety rules

  • Quit Xcode before you touch DerivedData, package caches inside it, or SwiftUI Previews. Do not delete DerivedData in the middle of a build.
  • Do not use rm -rf on ~/Library/Developer/CoreSimulator. Remove simulators and runtimes with simctl, so Xcode's device list stays in sync.
  • Do not add --volumes to Docker prune unless you have checked those volumes and have backups. Volumes often hold local databases.
  • Keep Xcode Archives for builds that are still on the App Store or TestFlight. Those archives hold the dSYMs used to read crash reports.
  • Leave credentials, signing keys, gradle.properties, SSH keys, cookies, and tool settings alone. This list is about caches and build output, not logins.
  • After a cleanup, empty the Trash. Time Machine local snapshots can also hold the space, so Finder may not update right away. List snapshots with tmutil listlocalsnapshots /.

Xcode DerivedData

Path: ~/Library/Developer/Xcode/DerivedData

This is rebuildable build state: build products, indexes, logs, and caches. It is not your source. It is often 10 to 50 GB. Xcode recreates it. The cost is one full rebuild per project, then a few minutes of indexing. For full details on clearing it and rebuild costs, read our guide on how to clear Xcode DerivedData.

du -sh ~/Library/Developer/Xcode/DerivedData

Quit Xcode, then:

rm -rf ~/Library/Developer/Xcode/DerivedData

Or, in Xcode: Settings, Locations, then the arrow next to Derived Data, and delete one project folder. "Clean Build Folder" (Shift-Command-K) is not the same thing. It only clears the current project's build products.

Xcode Compilation Cache

Path: ~/Library/Developer/Xcode/DerivedData/CompilationCache.noindex

This is the compiler cache inside DerivedData. Clean Build Folder leaves it in place. Some of its files are sparse, so Finder or a logical size can look larger than the disk space you will actually free. Compare apparent and allocated usage in our Xcode compilation cache guide.

cache_path="$HOME/Library/Developer/Xcode/DerivedData/CompilationCache.noindex"
du -sh "$cache_path"
du -A -sh "$cache_path"

On macOS, du reports allocated usage and du -A reports apparent usage. Quit Xcode, then move only that folder to Trash if you accept a slower next build:

mv ~/Library/Developer/Xcode/DerivedData/CompilationCache.noindex ~/.Trash/

If the path is missing, check Settings, Locations for a custom DerivedData folder.

Old simulators and runtimes

Device data (apps, photos, settings) lives at ~/Library/Developer/CoreSimulator/Devices. Runtime disk images (the OS a simulator boots) live in a system-managed store, not as ordinary folders in your home directory. Step by step instructions for managing runtimes and devices are in our guide to removing old iOS simulators.

Measure devices, then list runtimes:

du -sh ~/Library/Developer/CoreSimulator/Devices
xcrun simctl list devices
xcrun simctl runtime list

After an Xcode update, delete simulators whose runtime is gone:

xcrun simctl delete unavailable

That command does not delete runtime images. Keep the runtime for your minimum deployment target and the newest one. If devices still use an old runtime, shut them down, delete those devices, then delete the runtime by its id:

xcrun simctl delete <device-udid>
xcrun simctl runtime delete <identifier>

To wipe a simulator you still want to keep, without deleting the device:

xcrun simctl erase <device-udid>

You can also remove devices in Window, Devices and Simulators, and runtimes in Xcode, Settings, Components. If you need a runtime again, Xcode can download it from Settings, Components, or with xcodebuild -downloadPlatform iOS.

Do not delete CoreSimulator folders by hand, and do not eject or unmount runtime disk images yourself.

Xcode Archives

Path: ~/Library/Developer/Xcode/Archives

Every Product, Archive saves an .xcarchive (the app plus its dSYMs). Xcode does not delete them. They can grow to many GB.

du -sh ~/Library/Developer/Xcode/Archives
du -sh ~/Library/Developer/Xcode/Archives/* | sort -h

Delete old builds in Xcode: Window, Organizer, Archives, then Delete Archive. Or quit Xcode and move old date folders to Trash.

Keep the archive for every build that is still on the App Store or TestFlight. You need its dSYMs to turn crash reports into readable stack traces.

iOS DeviceSupport

Path: ~/Library/Developer/Xcode/iOS DeviceSupport

Xcode copies debug symbols from a physical device, one folder per device and iOS build, and does not remove the old ones. A folder can grow to many GB.

du -sh ~/Library/Developer/Xcode/"iOS DeviceSupport"
du -sh ~/Library/Developer/Xcode/"iOS DeviceSupport"/* | sort -rh

Quit Xcode. Keep the folder for the iOS version your phone runs today. Remove only older versions, one at a time:

rm -rf ~/Library/Developer/Xcode/iOS\ DeviceSupport/<old-ios-version>

Need one back? Xcode copies the symbols again the next time you plug in a matching device. There is a similar folder for watchOS DeviceSupport if you debug an Apple Watch.

Swift package caches

Xcode keeps a shared clone of every package at ~/Library/Caches/org.swift.swiftpm, plus another copy inside each project's DerivedData folder (DerivedData/<Project>-<hash>/SourcePackages).

du -sh ~/Library/Caches/org.swift.swiftpm
du -sh ~/Library/Developer/Xcode/DerivedData/*/SourcePackages

Quit Xcode, then:

rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/Developer/Xcode/DerivedData/*/SourcePackages

Packages download again on the next build. Package.resolved keeps the versions. For one project, you can use File, Packages, Reset Package Caches.

Leave ~/Library/org.swift.swiftpm alone. It holds SwiftPM settings and package fingerprints, not a cache.

Gradle (Android and JVM on a Mac)

Usual paths: ~/.gradle/caches and ~/.gradle/wrapper/dists. The Android SDK, if you use the default location, is ~/Library/Android/sdk. AVD device data is ~/.android/avd. Check Android Studio, Tools, SDK Manager, or ANDROID_HOME, if yours differs. See our guides on how to clear the Gradle cache and cleaning Android Studio and Gradle caches for detailed breakdowns.

du -sh ~/.gradle/caches ~/.gradle/wrapper/dists 2>/dev/null
du -sh "$HOME/Library/Android/sdk" 2>/dev/null
du -sh ~/.android/avd 2>/dev/null

Quit Android Studio. In each Android project you still build, stop daemons:

./gradlew --stop

The local build cache is safe to remove. The next build recreates it. Downloaded dependencies in ~/.gradle/caches/modules-2 (and metadata-*) come back only with a network, and offline or private-repo builds fail until they are fetched again. Leave gradle.properties, credentials, signing keys, and init scripts in ~/.gradle alone.

A cautious cleanup of rebuildable cache, not the whole ~/.gradle folder:

# inspect first
du -sh ~/.gradle/caches/* | sort -h

Remove only a folder you have identified, such as build-cache-1 or old transforms-* / versioned cache folders. If you clear modules-2, expect a slower next build and a network download.

Do not delete the entire Android SDK. Remove unused platforms, build-tools, NDK, or system images from SDK Manager after you check what your projects pin. An AVD is device state, not a cache. Delete unused emulators from Device Manager, not by wiping ~/.android/avd in one go.

node_modules and JavaScript package caches

node_modules sits in each project. It is installed dependencies, not your source. Keep package.json and the lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml). See our in-depth guides on removing node_modules safely, clearing the npm cache, clearing the Yarn cache, and pnpm store pruning and cleanup.

From the project directory, and only if the lockfile is present:

du -sh node_modules
rm -rf node_modules
npm ci

If the project uses Yarn or pnpm, reinstall from the lockfile with that tool's frozen or immutable install (Yarn 1: yarn install --frozen-lockfile; Yarn Berry: yarn install --immutable; pnpm: pnpm install --frozen-lockfile). Do not delete node_modules when the lockfile is missing, or you may not be able to restore the same versions.

Shared download caches (the next install fetches them again):

Tool Usual path Clean command
npm ~/.npm npm cache clean --force
Yarn ~/Library/Caches/Yarn (Yarn 1) or ~/.yarn/berry/cache (Yarn Berry) yarn cache clean (Yarn Berry, version 2 and later: yarn cache clean --all)
pnpm ~/Library/pnpm/store (or pnpm store path) pnpm store prune
du -sh ~/.npm ~/Library/Caches/Yarn ~/.yarn/berry/cache ~/Library/pnpm/store 2>/dev/null

Docker

On macOS, Docker data lives inside a virtual machine disk (Docker Desktop: ~/Library/Containers/com.docker.docker), not as ordinary files in Finder. Leave Docker running so the commands can talk to the daemon. For a detailed breakdown, see our guide on cleaning Docker safely on macOS.

docker system df

Safe first pass: stopped containers, dangling images, and unused networks:

docker system prune

Build cache:

docker builder prune

docker system prune -a also removes unused images, not just dangling ones. You will have to pull those images again. Do not add --volumes unless you have listed the volumes, know what they hold, and have backups. Volumes are often local databases, and you cannot rebuild them from a cache.

CocoaPods

Two folders:

  • ~/Library/Caches/CocoaPods: shared download cache
  • ~/.cocoapods/repos: spec repos
du -sh ~/Library/Caches/CocoaPods ~/.cocoapods/repos
pod cache list
pod cache clean --all

Your projects and their Pods folders stay. The next pod install downloads what it needs.

Older setups may still have the full master spec repo from before CocoaPods switched to the CDN:

pod repo list
pod repo remove master

If a Podfile still has source 'https://github.com/CocoaPods/Specs.git', switch it to source 'https://cdn.cocoapods.org/' first, or the next install may clone the huge repo again.

Homebrew

Cache path: ~/Library/Caches/Homebrew

du -sh ~/Library/Caches/Homebrew
brew cleanup

brew cleanup keeps recent downloads. To clear every cached bottle and old formula version:

brew cleanup --prune=all
brew autoremove

Your installed tools keep working. brew autoremove uninstalls orphaned dependencies you no longer need.

Also check

SwiftUI Previews: ~/Library/Developer/Xcode/UserData/Previews. Regenerable. Quit Xcode first. Xcode can recreate them when you open a preview.

Xcode Products: ~/Library/Developer/Xcode/Products. Organizer icon copies, one folder per app and version. Quit Xcode, then move old app folders to Trash one at a time. Archives and dSYMs live under Archives and stay put.

du -sh ~/Library/Developer/Xcode/Products
du -sh ~/Library/Developer/Xcode/Products/* | sort -h

DVTDownloads: ~/Library/Developer/DVTDownloads. Where Xcode stages platform and component downloads. Often small or empty. Quit Xcode, make sure no download is running, then move leftover contents to Trash. Installed simulators and runtimes live elsewhere.

du -sh ~/Library/Developer/DVTDownloads

Swift toolchains: ~/Library/Developer/Toolchains (sometimes also /Library/Developer/Toolchains). Switch Xcode back to its own toolchain, then remove snapshot toolchains you do not use. Xcode's built-in Swift stays. Releases can be reinstalled from swift.org.

du -sh ~/Library/Developer/Toolchains/*

Xcode documentation cache: ~/Library/Caches/com.apple.dt.Xcode. Safe to clear.

Maven: ~/.m2/repository. Downloaded dependencies. The next build fetches them again.

du -sh ~/.m2/repository

Project build folders you can regenerate, in projects you are not working on: node_modules, Swift .build, Rust target, and CocoaPods Pods. Leave the project you have open. In a Rust project, cargo clean wipes that project's target.

What not to delete

  • Xcode Archives for builds still on the App Store or TestFlight
  • Docker volumes, unless you have checked them and have backups
  • The entire Android SDK, or AVDs you still use
  • ~/Library/org.swift.swiftpm (SwiftPM settings, not a cache)
  • Tool settings, credentials, signing keys, and session data
  • Downloaded LLM models, unless you mean to remove a specific model. Re-downloading large weights takes time and bandwidth. More in our AI coding tools guide.

If free space does not change

Empty the Trash. Time Machine local snapshots can keep the blocks allocated. List them with:

tmutil listlocalsnapshots /

Finder and About This Mac can also disagree when files are sparse, cloned, or still held open. For Compilation Cache, compare allocated size (du) with apparent size (du -A) and with df -h "$HOME" before and after. For more details on why storage numbers disagree, see our guide on what System Data is on Mac and how to clear it.

DevCleaner does this list for you

If you would rather scan these folders in one place, DevCleaner for macOS 1.17.2 finds them, labels each row Safe, Warning, or Danger, and does not pre-select risky items. It runs on macOS 14 or later.

Download DevCleaner: free ↓
Safe cleanup free · ~13 MB · macOS 14+ · live disk badge in your menu bar
Developer ID signed · notarized by Apple

References and scope

Paths and commands follow the public DevCleaner guides. Locations can change with tool versions and custom settings. Check the installed tool's help before you run a delete command.

Featured on TryMacApps Featured on UsefulShelf Featured on Formac Listed on MacTools Pro Fazier badge