Adam Rush

@Adam9Rush

6 December, 2021

Have you tried deleting Derived Data?

It’s probably the most common statement that you hear within your iOS team, although “Code Signing” could also be up there and in this article, we will explore what derived data is and how you can clear that pesky cache.

It’s hard to argue with this caching mechanism though, by deleting this every time, I saw a build time increase by over 40%.

What is Derived Data?

It’s a folder that by default exists at ~/Library/Developer/Xcode/DerivedData and as you begin using Xcode it will store various items:

  • Intermediate Build Results
  • Generated Indexes
  • Module Caches
  • Logs
  • Symbol Caches

The basic way to explain this is that it’s a caching mechanism for Xcode, which means that when you start using and building your iOS apps it will store these items to make your developer workflow faster.

Why the Problem?

By far Derived Data has many more benefits than negatives, but sometimes you’ll likely face an issue or build failure that is indeed cached and isn’t a *real* error.

If you’re facing an error that is unexplainable it’s well worth deleting this folder and performing a clean build.

Deleting Derived Data

Let’s take you through the process of wiping your Derived Data.

Open Terminal

cd ~/Library/Developer/Xcode/DerivedData

This will navigate you to your Derived Data folder

open .

You should now be able to see your Derived Data with all the individual folders that relate to each of your Xcode projects.

The derived data folder on macOS
You can simply, select all the items and hit delete, or if you’re feeling adventurous perform the following from the Terminal app.
rm -rf ~/Library/Developer/Xcode/DerivedData

This will clear down the contents of your Derived Data folder.

Finally, it’s worth noting that the Derived Data folder can be heavy on storage, so it’s worth keeping an eye on the contents of this folder to make sure you’re not carrying legacy projects cache.

Sponsor

Subscribe for curated Swift content for free

- weekly delivered.