As you work with Xcode for a long time, your hard drive space becomes less and less free. The main reason is that a lot of things are created automatically when you build projects. The place where a large number of files were created this way is the DerivedData folder. Its size can be from a few hundred MB to dozens of GB. Luckily, you’re fine with deleting files in this folder. There will be no consequences to this action and the benefit you will gain is more space on your Mac.
This article shows you 2 different ways to delete derived data in Xcode 13, 14, and newer versions.
Using Your Mouse (Graphical User Interface)
1. Open Xcode and go to Xcode > Settings (or Preferences in Xcode 13) as follows:
2. Select the Locations tab from the menu bar. Focus on the Derived Data section. Here you will see the path of the DerivedData folder on your Mac. Click on the right arrow icon next to the path to quickly access this folder.
3. Open the DerivedData folder to view its content:
4. Delete every sub-folder inside DerivedData (it’s totally safe to do that). Don’t forget to empty your Trash later.
Using Command Line
You can clean the DerivedData folder by using just a single command. Open your terminal and run the following:
rm -rf ~/Library/Developer/Xcode/DerivedData/*
We’ve gone over a few approaches to remove Xcode derived data so that we can get back a lot of free storage. If you’d like to explore more tips and tricks to get more productibility when working with Xcode, take a look at the following articles:
- How to Change the Default Text Encoding in Xcode
- How to Adjust Indents and Spacing in Xcode
- How to Download and Install an iOS Simulator in Xcode
- How to Toggle Dark Mode on iOS Simulator
- How to Change Theme in Xcode
I have made every effort to ensure that every step in this article works properly, but I may have made some mistakes or omissions. If so, please leave a comment to report errors.