Home/Glossary/What is DerivedData in Xcode, and is it safe to delete?

What is DerivedData in Xcode, and is it safe to delete?

Updated · airankrush

Term · DerivedData (Xcode's derived data folder)

DerivedData is the folder where Xcode stores "derived data". By default it sits in the Developer/Xcode folder of your user Library, and every project you have opened gets a subfolder in it. The contents include intermediate files from compilation, built products, the code index, module caches and logs. All of this can be regenerated from source, so the whole folder can be deleted at any time; the only cost is that the next build compiles from scratch and the index has to be rebuilt. It does not shrink by itself and grows very large when you have many projects or switch branches often. Clearing it is a common first troubleshooting step when a build error makes no sense.

How it relates to renting a remote Mac

The link between DerivedData and a rented machine is mainly a trade-off between disk space and build speed.

Disk: the storage on a rented Mac is set by the configuration you chose (see the plans page) and cannot be added to on the fly. The big Xcode-related consumers are DerivedData, simulator runtimes, old archives, and the caches of dependency managers. When disk is tight, clear DerivedData first, because it is the least painful to lose.

Build speed: when you use the machine as an always-on build machine, keeping DerivedData is exactly one of the advantages of your own build machine over a throwaway cloud environment: the intermediates from the last run are still there, and incremental builds can pick up from them. Ephemeral cloud environments start clean every time and have to make up for it with extra caching mechanisms. So on a build machine do not clear it out of habit on every run, unless a completely clean build is what you want. We have no measured timings for the two approaches; the difference depends on the project.

End of rental: there is nothing in DerivedData you need to take with you, and no backup is needed. What you need to take is source code, the debug symbols in your archives, and signing private keys.

FAQ

Will deleting DerivedData break my project?

No. It contains no source code or project configuration, only regenerable caches. Quit Xcode before deleting, then reopen it and wait for indexing to finish.

Can I move DerivedData somewhere else?

Xcode's settings let you change where derived data is stored, and command-line builds can specify it with a parameter. Rented machines do not take external drives, so normally you keep the default and clean it up periodically.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · Glossary