PitlaneXcode replacement for indie developers

How to clear Xcode's DerivedData

Where it lives, three ways to clear it, and what to try when that is not enough.

Download for macOS (v1.1.1)
Pitlane building a project: the project list on the left, the build log on the right, and a menu to resolve packages and clear caches

What DerivedData is

Xcode keeps the build products, indexes and logs for every project in one folder: ~/Library/Developer/Xcode/DerivedData. Each project gets a subfolder named after it, with a random suffix.

Deleting it is safe. Xcode builds it again, and the next build takes longer because nothing is cached.

Clear it for one project

List the folder, then remove the one that belongs to your project.

ls ~/Library/Developer/Xcode/DerivedData
rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-*

Clear it for every project

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

Clean without deleting the folder

In Xcode, choose Product, then Clean Build Folder, or press Shift-Command-K. From Terminal, the clean action removes build products and intermediate files.

xcodebuild -scheme MyApp clean

When that is not enough

Stale Swift packages cause the same symptoms, and they live elsewhere. SwiftPM keeps a global cache in ~/Library/Caches/org.swift.swiftpm, apart from DerivedData.

The order Pitlane tries things in

Pitlane has a reset ladder. Each rung throws away more than the one before, so you start with the cheapest fix.

  1. Resolve packages
  2. Clean the build folder
  3. Clear this project's DerivedData
  4. Reset the package caches
  5. Clear the global SwiftPM cache
  6. Kill stuck processes

It tells you what it cleared.

See Pitlane

Questions

Where is Xcode's DerivedData folder?

In your home folder, at ~/Library/Developer/Xcode/DerivedData. Each project has its own subfolder, named after the project with a random suffix.

Is it safe to delete DerivedData?

Yes. It holds build products, indexes and logs, and Xcode builds them again. The next build takes longer because nothing is cached.

How do I clear DerivedData without opening Xcode?

Delete the folder from Terminal with rm -rf ~/Library/Developer/Xcode/DerivedData, or delete only your project's subfolder. Pitlane does it from a menu, for one project at a time.

Pitlane

Every iOS project in one window

$29 once. One license covers two Macs.

The other tools

Docket

Tasks, releases and launches for every app you ship.

Download Docket on the App Store

Metrics

App Store numbers on your Home Screen and Lock Screen.

Download Metrics on the App Store