If Xcode is showing stale errors, refusing to rebuild, or behaving strangely after a project change, clearing Derived Data can be a useful troubleshooting step. Derived Data contains generated files such as build products, indexes, and intermediate information. Removing it does not delete your project’s source code, but Xcode will need to recreate some of these files the next time you open and build the project.
The simplest way to clear Xcode Derived Data is through Xcode’s settings. You can also remove a specific project’s data in Finder or delete the entire Derived Data folder manually. This guide explains each method, when to use it, and what to expect afterward.
What Is Xcode Derived Data?
Derived Data is a collection of files Xcode generates while working with your projects. It can include compiled build products, indexes used for code completion and navigation, intermediate files, and other information that helps Xcode build and analyze your code.
By default, Xcode stores this data in your user Library folder, separate from the folder where your project’s source files live. The usual location is:
~/Library/Developer/Xcode/DerivedData
Xcode creates separate folders for projects and workspaces in this location. The folder names may include both the project name and a string of letters and numbers, so they may not look immediately recognizable.
Derived Data can take up considerable disk space, especially if you work on several projects or have built different configurations and targets. It can also become outdated or inconsistent after changes to a project, Xcode, or its build settings. Deleting it gives Xcode a clean set of generated files to recreate.
What Happens When You Clear Derived Data?
Clearing Derived Data removes generated information, not your original app or project files. Your source code, assets, project settings, and files saved in your project folder remain in place. However, the next build may take longer because Xcode has to compile the project and regenerate indexes and other data again.
You might notice that code completion, indexing, or navigation takes a little time to return to normal after deletion. Xcode may also download or resolve dependencies again if the project needs them and they are not available elsewhere. For a large project, the first clean build can take noticeably longer than usual.
Clearing Derived Data is not the same as deleting an app from a simulator, removing an archive, or clearing every cache used by Xcode. Those items are stored in other locations and generally require separate cleanup.
Method 1: Clear Derived Data in Xcode Settings
Using Xcode’s settings is usually the safest and easiest method. It lets you see the current Derived Data location and open that folder without typing a path manually.
- Open Xcode.
- Choose Xcode > Settings from the menu bar. In older Xcode versions, this option may be called Xcode > Preferences.
- Select the Locations tab.
- Find the Derived Data setting.
- Click the small arrow beside the location to open the folder in Finder.
- In Finder, move the project folder or folders you want to remove to the Trash.
- Empty the Trash if you want to reclaim the disk space immediately.
To clear Derived Data for just one project, delete only the folder that corresponds to that project. If you want to remove all generated project data, you can delete all the contents of the Derived Data folder. Avoid deleting the parent Developer folder or other Xcode folders by mistake.
The folder names are not always identical to the project names. If you are unsure which one belongs to a project, use the project’s name and the folder’s contents as clues. You can also close Xcode, remove the contents, and let Xcode recreate what it needs when you open the project again.
Method 2: Delete Derived Data in Finder
You can go directly to the default Derived Data location in Finder. This is convenient when Xcode is closed or when you prefer to manage files without opening its settings.
- Open Finder.
- Choose Go > Go to Folder from the menu bar, or press Shift-Command-G.
- Enter
~/Library/Developer/Xcode/DerivedDataand press Return. - Select the project folder you want to remove, or select the contents to clear all projects’ Derived Data.
- Move the selected items to the Trash.
The tilde in the path represents your macOS home folder. Enter the path exactly as shown, including the spaces and capitalization. If Finder reports that the folder does not exist, Xcode may be using a custom Derived Data location, or it may not have created the folder yet. Check the Locations tab in Xcode settings to confirm the configured path.
Deleting one project’s folder is a good first step if you are troubleshooting a single project. Removing everything is reasonable when you need to reclaim space or suspect that generated files across multiple projects are causing problems.
Method 3: Clear Derived Data Using Terminal
If you are comfortable using Terminal, you can remove the contents of the default Derived Data folder with a command. First, quit Xcode so it is not actively using the files. Then open Terminal and run:
rm -rf ~/Library/Developer/Xcode/DerivedData
This command permanently removes the Derived Data folder and its contents rather than placing them in the Trash. Check the path carefully before pressing Return. Do not add spaces or change the path unless you are certain you are targeting the correct folder.
If you would rather inspect the folder before deleting anything, open it in Finder first or list its contents in Terminal:
ls ~/Library/Developer/Xcode/DerivedData
If you have configured a custom location in Xcode, the default Terminal command will not clear that location. Check Xcode > Settings > Locations and use the path displayed there instead. When in doubt, use Finder or Xcode’s settings rather than running a deletion command.
Should You Delete One Project’s Data or Everything?
Choose the smallest cleanup that addresses the problem. If only one project has stale errors or a failing build, remove that project’s Derived Data folder first. This avoids making Xcode rebuild and reindex unrelated projects.
Clear all Derived Data when you are running low on disk space, when several projects are acting inconsistently, or when you want to remove all generated project data at once. The trade-off is that the next time you open those projects, Xcode may take longer to prepare them.
- One project has a problem: Delete that project’s Derived Data folder.
- Several projects have problems: Consider clearing the entire Derived Data folder.
- You need disk space: Check the folder size first, then remove project data you no longer need.
- You are unsure: Start by removing only the affected project’s folder.
What to Do After Clearing Derived Data
After deleting Derived Data, reopen the project in Xcode. Give Xcode time to index the files, then build the project again. The first build may be slower because Xcode has to recreate its intermediate files and compile the project from scratch.
- Open the correct project or workspace file.
- Wait for indexing or package resolution to finish if Xcode is still processing.
- Choose the appropriate scheme and destination, such as a simulator or connected device.
- Select Product > Build or use the build shortcut.
- Check the build log for any remaining errors.
If the same error returns after a clean build, Derived Data may not have been the cause. Review the error message, confirm that the correct scheme and destination are selected, and check whether the project’s dependencies and build settings are valid.
Does Clearing Derived Data Fix Xcode Build Errors?
Sometimes. Clearing Derived Data can help when a build is relying on outdated generated files, when Xcode’s index appears inconsistent with the current source, or when a project’s build products seem corrupted. It is a sensible troubleshooting step because it removes generated data without deleting project source files.
It will not fix every build problem. Errors caused by invalid Swift or Objective-C code, missing files, incorrect signing settings, unavailable dependencies, or unsupported deployment targets will remain until those underlying issues are addressed. Treat clearing Derived Data as a way to reset generated project information, not as a replacement for diagnosing the build error.
If Xcode continues to show stale issues, close and reopen the project after clearing the folder. Also check that you opened the expected workspace or project and that the issue is not coming from a different build destination or scheme.
Other Xcode Files That Are Not Derived Data
Several types of Xcode data live outside the Derived Data folder. Deleting Derived Data will not necessarily remove old simulator devices and their contents, saved archives, or every package and download cache. These files have separate storage locations and serve different purposes.
For example, archives are managed through Xcode’s Organizer, while simulator devices can be managed through the Devices and Simulators window. If your goal is to free space, check those areas separately before removing anything. An archive may be needed to distribute or inspect a previously built app, and simulator data may contain information you want to keep.
It is also worth checking whether the Derived Data location has been customized. Xcode’s Locations settings show the active location, so you can avoid deleting the wrong folder or assuming that the default path contains all of your project data.
Frequently Asked Questions
Can I clear Derived Data while Xcode is open? It is better to quit Xcode first, especially when deleting files manually or with Terminal. Xcode may be using generated files during a build or indexing operation. Closing the app reduces the chance of interruption or confusing results.
Will deleting Derived Data remove my project? No. Derived Data is separate from your project’s source files. Still, confirm that you are deleting the folder inside the configured Derived Data location, not your project directory.
How often should I clear Derived Data? There is no required schedule. Clear it when troubleshooting a project, reclaiming disk space, or addressing suspected stale generated files. Routine deletion is usually unnecessary because Xcode manages this data as part of its normal workflow.
Will Xcode recreate the folder? Yes. Xcode recreates the necessary Derived Data as you open, index, and build projects. The first build after cleanup may take longer than subsequent builds.
Conclusion
To clear Xcode Derived Data, open Xcode > Settings > Locations, use the arrow beside the Derived Data location to open it in Finder, and delete either the affected project’s folder or all of the contents. You can also navigate to ~/Library/Developer/Xcode/DerivedData in Finder or use Terminal after carefully checking the path.
Clearing Derived Data removes generated files, not your source code, and can help with stale indexes, unusual build behavior, or disk-space concerns. Afterward, reopen the project, allow Xcode to reindex, and build again. If the problem persists, investigate the specific error, since not every Xcode issue is caused by Derived Data.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.