Delete derived data with Xcode

Xcode can often do some strange things that causes build problems etc. One of the go to methods to try and fix these issues is to delete derived data. In this tutorial, I will show you how you can delete the derived data.

Step 1: Open Preferences

The first thing we need to do is to open preferences, there are two ways to do this. The first way is to click on Xcode in the top left of the menu bar and then to click on Preferences:

If you want to use a shortcut to open preferences, you can do this cmd + ,.

Once you have used one of the above methods to open Preferences, you should see a window like this:

Step 2: Open Derived Data location in Finder

To open the location in finder, click on the arrow next to the file path below Derived Data:

When you click on the arrow, finder will open up with the Derived Data folder highlighted:

Step 3: Close Xcode

This is a super quick step, we need to quit Xcode before we delete the derived data. I normally force quit Xcode instead of quitting normally, but I cannot say if it make a real difference or not.

Step 4: Delete DerivedData folder

Now that Xcode is closed and our DerivedData folder is location is open in finder, we can delete the whole DerivedData folder.

Once I have deleted the DerivedData folder I make sure to delete it from the trash as well. Normally I completely empty my trash folder, but you can just delete the DerivedData folder.

After removing the folder from trash you can start Xcode again. When you build the app it will recreate either the DerivedData folder.

Conclusion

Deleting derived data can be annoying, it also seems to be something that depends on the project. I have been working on multiple projects and it seems that the smaller projects don't really have these issues as often as the larger projects.