---
title: "How to clear Xcode DerivedData safely on a Mac · MacMelon"
description: "DerivedData is safe to delete and Xcode rebuilds it. How to see what is big, remove one project or all of it, and what else in the Xcode folders is not safe."
url: "https://macmelon.com/guides/how-to-clear-xcode-deriveddata-safely"
---

# How to clear Xcode DerivedData safely

DerivedData holds build products, indexes and logs that Xcode recreates, so deleting it is safe when Xcode is closed. The cost is one slow rebuild. This guide shows how to measure it, remove it, and avoid the Xcode folders that are not disposable.

By [Harish Ganapathi](https://macmelon.com/about), Co-founder · Updated November 18, 2026

DerivedData is the folder where Xcode puts everything it generates while you work: compiled build products, the index that powers code completion, build logs and the module cache. Your source code is never stored there. Because Xcode can regenerate all of it, deleting DerivedData is one of the safest ways to get disk space back, and the standard first fix for strange build errors.

It is also the folder that most often grows large, because every project you have ever opened leaves a copy behind. On the Mac we measured while writing this, it held 3.2 GB from a handful of projects.

## What you lose, and what you do not

You lose build speed, once. The next build of each project compiles from scratch, and the index rebuilds, so code completion is slow for a minute or two. Swift packages are fetched again, so the first build afterwards needs a network connection. You do not lose source code, project settings, signing identities or anything under your project folders.

## Step 1: See how big it is, and which projects

Each project gets its own folder named after the project, a dash and a hash. Sorting them shows which ones are worth clearing.

Total size of DerivedData

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

Largest projects first

```
du -sh ~/Library/Developer/Xcode/DerivedData/* | sort -rh | head -10
```

You can also open the folder from Xcode: Settings > Locations, then click the small arrow next to the DerivedData path.

-   [DerivedData](https://macmelon.com/glossary/deriveddata)

## Step 2: Quit Xcode, then remove it

Quit Xcode first. Deleting DerivedData while Xcode is open can leave it with a half-built index and produce confusing errors. Then either move the folders to the Trash in Finder, which lets you put them back, or remove them from Terminal.

Check the path before you press Return. `rm -rf` does not use the Trash and cannot be undone.

Remove one project's DerivedData (replace the folder name with one from Step 1)

```
rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-abcdefghijklmnop
```

Remove all DerivedData

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

The folder itself stays. Xcode creates what it needs the next time you build.

## Clean Build Folder is not the same thing

Product > Clean Build Folder (Shift-Command-K) removes the build products for the current project only. It does not touch the index, the module cache or other projects. It is the right first try for one misbehaving project. Deleting DerivedData is the bigger step, for when that does not help or when you want the space back.

## Other Xcode folders: what is safe and what is not

DerivedData is disposable. Its neighbours are not all disposable, and these are the ones people delete by mistake.

-   **Archives** (`~/Library/Developer/Xcode/Archives`): do not delete casually. They hold the builds and debug symbols for versions you shipped, which you need to symbolicate crash reports.
-   **iOS DeviceSupport** (`~/Library/Developer/Xcode/iOS DeviceSupport`): safe to delete. Xcode copies the symbols again the next time you connect that device, which takes a few minutes.
-   **Simulators** (`~/Library/Developer/CoreSimulator`): remove old runtimes in Xcode > Settings > Components. To drop simulators that no longer match an installed runtime, run `xcrun simctl delete unavailable`.
-   **UserData** (`~/Library/Developer/Xcode/UserData`): keep. It holds your key bindings, themes and code snippets.

-   [How to delete Xcode simulators and Device Support files](https://macmelon.com/guides/how-to-delete-xcode-simulators-and-device-support)

## When to let an app do it

[Disk Housekeeper](https://macmelon.com/apps/disk-housekeeper) includes Xcode DerivedData in Smart Clean, shows every project's folder and size in a preview before anything is removed, and sends removals to the Trash by default so you can put them back. Scanning, previews and your first 2 GB of cleaning are free.

-   [Clear Xcode DerivedData with a preview](https://macmelon.com/use-cases/clear-xcode-deriveddata)
-   [How to clean developer files on macOS](https://macmelon.com/guides/how-to-clean-developer-files-on-macos)

## Questions

Is it safe to delete DerivedData?

Yes. DerivedData holds only things Xcode generates: build products, indexes, logs and the module cache. Quit Xcode first. The next build of each project is slower because it compiles from scratch, and Swift packages download again.

Where is Xcode DerivedData on a Mac?

In `~/Library/Developer/Xcode/DerivedData`. You can open it from Xcode under Settings > Locations by clicking the arrow beside the DerivedData path.

Will deleting DerivedData break my project?

No. It contains no source code or project settings. The worst case is a slow first build and a short period of reduced code completion while Xcode re-indexes.

Why is my DerivedData so large?

Every project you open gets its own folder, and Xcode does not remove them when you stop using the project. Old projects, branches and checkouts keep their build products and indexes until you delete them.

Should I delete Xcode Archives too?

Not unless you are sure you never need them. Archives hold the builds and debug symbols for versions you shipped. You need those symbols to read crash reports for those versions.

## Related use cases

[### Clear Xcode DerivedData](https://macmelon.com/use-cases/clear-xcode-deriveddata)[### Clean npm, Gradle, and Cargo caches](https://macmelon.com/use-cases/clean-developer-caches)[### Free up space on a MacBook](https://macmelon.com/use-cases/free-up-space-on-a-macbook)

## Related terms

[### DerivedData](https://macmelon.com/glossary/deriveddata)[### Xcode](https://macmelon.com/glossary/xcode)[### Developer cache](https://macmelon.com/glossary/developer-cache)[### Trash](https://macmelon.com/glossary/trash)[### Preview before cleaning](https://macmelon.com/glossary/preview-before-cleaning)

## Related notes

[### Deleting node\_modules without regretting it](https://macmelon.com/blog/deleting-node-modules-without-regrets)
