If Xcode is taking up too much space, builds are failing for no clear reason, or the simulator is behaving strangely, clearing Xcode’s generated files can often help. Xcode stores build products, indexes, simulator data, downloaded packages, and device support files on your Mac. Some of these are safe to remove because Xcode can recreate them; others, such as app archives and simulator data, may contain work you want to keep.
This guide explains how to clear Xcode safely, where its largest files are stored, and what to check before deleting anything. Whether you want to clear Xcode cache, free disk space, or troubleshoot a project, start with the least destructive option and work your way through the steps below.
What Does “Clear Xcode” Mean?
There is no single button that clears every Xcode file. The phrase usually means removing one or more categories of data that Xcode creates while you develop. The right choice depends on your goal: clearing build files may fix a project issue, while deleting old archives may be the better way to reclaim storage.
- Derived Data: Build outputs, indexes, and other project-specific files. Xcode can recreate these.
- Module and package caches: Downloaded or compiled dependencies that may be refreshed if needed.
- Simulator data: Installed apps, settings, and other data stored in simulated devices.
- Archives: Saved builds commonly used for distribution or keeping release records.
- Device support files: Files used when developing with particular iOS or other Apple device versions.
Clearing temporary files can solve some problems, but it will not fix every Xcode issue. It also may make the next build or launch slower while Xcode downloads or generates replacement files.
Before You Clear Xcode
Save your work and close Xcode. If you are removing simulator data, quit the Simulator app too. Check that your project is committed to version control or backed up, especially if it contains files you have not saved elsewhere. Xcode’s generated caches are not the same as your source code, but deleting the wrong folder can remove important project data or release records.
It is also useful to check what is actually using disk space. On recent versions of macOS, open System Settings, choose General, then Storage. The labels and layout can vary by macOS version. In Xcode, you can also review the Archives section in the Organizer to identify old builds before removing them.
How to Clear Xcode Derived Data
Derived Data is often the best first step when a build behaves unexpectedly or Xcode is using a lot of space. It contains generated files such as build products and indexes. Removing it does not delete your project’s source files, but Xcode will need to rebuild and re-index the project the next time you open it.
To delete Derived Data in Xcode:
- Open Xcode.
- Choose Xcode > Settings on newer versions, or Xcode > Preferences on older versions.
- Open the Locations tab.
- Find the path shown beside Derived Data and click the arrow to open it in Finder.
- Quit Xcode, then move the relevant project folder or the contents of the Derived Data folder to the Trash.
The standard location is ~/Library/Developer/Xcode/DerivedData. You can open it in Finder by choosing Go > Go to Folder from the menu bar, entering the path, and pressing Return. If you use multiple Xcode installations or have changed the location in Settings, follow the path displayed in Xcode instead.
To clear Derived Data for only one project, remove that project’s matching folder rather than everything in the directory. If you delete the entire Derived Data folder, Xcode will recreate what it needs, but all projects may require a fresh build or indexing pass.
Use Clean Build Folder for a Quick Build Reset
If you are troubleshooting one project and do not need to remove all of its generated data, try Xcode’s built-in clean command first. Open the project, choose Product > Clean Build Folder, and confirm if prompted. The usual keyboard shortcut is Shift-Command-K. In some Xcode versions, you may need to hold the Option key while opening the Product menu to see the Clean Build Folder command.
Cleaning the build folder removes project build products so Xcode can compile them again. It is less comprehensive than deleting Derived Data, so it may not resolve problems caused by stale indexes or other cached information. It is a convenient first troubleshooting step because it does not require you to locate folders manually.
How to Clear Xcode’s Package Caches
Swift Package Manager and Xcode keep package information and downloaded dependencies so projects can build without fetching everything again. If a package seems stuck, corrupted, or out of date, refresh the package data for that project before deleting broader cache folders.
In Xcode, open the project and look under File > Packages. Depending on your Xcode version, you may see options such as Reset Package Caches or Resolve Package Versions. Resetting the cache can require Xcode to download dependencies again, so make sure you have a working internet connection if the project relies on remote packages.
Some package data is stored inside Derived Data, often in a project’s SourcePackages folder. Removing the project’s Derived Data can therefore also remove related package checkouts. Avoid deleting unfamiliar folders elsewhere in your Library just because they contain the word “cache”; first confirm what the folder is used for and whether Xcode can safely recreate its contents.
How to Remove Old Xcode Archives
Archives can take up substantial storage, but they are not simply temporary cache files. They may contain release builds, symbols, and information you need to submit an app, distribute it, or investigate a crash. Do not delete archives unless you are sure you no longer need them or have a separate backup.
To review them, open Xcode and choose Window > Organizer, then select Archives. Review the app name, version, date, and distribution status before removing anything. You can delete selected archives in Organizer, with the exact controls varying by Xcode version. If you use archives for App Store Connect submissions or internal releases, confirm that the build has been uploaded and that you have retained any files your team requires.
Archives are commonly stored under ~/Library/Developer/Xcode/Archives. You can inspect this location in Finder, but using Organizer makes it easier to identify what each archive belongs to. Deleting an archive is not the same as clearing a build cache: Xcode cannot recreate an old archived release exactly unless you rebuild it from the same source and settings.
How to Clear iOS Simulator Data
Simulator data includes installed apps, app documents, preferences, and other information held by each simulated device. Erasing it can help when a simulator is misbehaving or when you need a clean test environment. However, it permanently removes data stored in that simulator, so save anything you need first.
To erase one simulator, open Window > Devices and Simulators in Xcode. Select the relevant simulator and look for the option to erase its content and settings. You can also open the Simulator app, choose a device, and use its Device menu to find Erase All Content and Settings. Menu names and locations can differ slightly between versions.
For a broader reset, Xcode’s simulator management tools let you remove unavailable or unwanted simulator devices. Avoid deleting simulator folders by hand unless you understand what they contain. Removing device data will not usually remove your project, but it can mean reinstalling apps and repeating simulator setup.
Should You Delete iOS Device Support Files?
Xcode may store support files for iOS devices and operating-system versions you have used for development. These files can consume significant disk space, particularly if you work with several device or iOS versions. They are not the same as your project files, but deleting them can mean Xcode has to prepare or download support files again when you connect a device.
Before removing anything, check your available storage and consider whether you still develop or test with the relevant device versions. Xcode’s device-management screens and macOS storage view can help you assess what is installed. Avoid deleting the entire Developer directory: it may contain simulators, archives, device support, and other data you did not intend to remove.
Can You Clear Xcode from Terminal?
You can use Finder to remove generated files, or use Terminal if you are comfortable checking paths carefully. Quit Xcode first. To open the standard Derived Data folder in Finder from Terminal, enter:
open ~/Library/Developer/Xcode/DerivedData
Then review the folder and move only the data you intend to remove to the Trash. If you use a deletion command, verify the full path before running it. Commands such as rm -rf can permanently remove files without putting them in the Trash, and a typo or overly broad path can delete important data. For most users, Finder or Xcode’s own settings and Organizer are safer choices.
What Not to Delete When Clearing Xcode
Do not remove your project’s source folder, Git repository, certificates, provisioning profiles, or signing assets as a way to clear Xcode cache. These items may not be recoverable from Xcode itself. Be cautious with anything under ~/Library/Developer: it contains a mixture of regenerable files and data that may represent work, releases, or device state.
- Keep a backup of archives you may need for releases or debugging.
- Do not erase simulator content until you are comfortable losing its installed apps and data.
- Do not delete folders based only on their names; check their location and purpose.
- Do not expect clearing caches to repair a damaged project or fix every compiler error.
What to Do After Clearing Xcode
Reopen Xcode and let it finish any indexing or package resolution. Build the project again and allow extra time for the first build, since Xcode may need to recreate Derived Data, compile dependencies, or download packages. If a problem remains, note the exact error message and check your project settings, Xcode version, selected developer directory, and dependency versions before repeating the cleanup.
If disk space is still low, review archives, unused simulators, and other large files separately. Clearing caches is most effective when you target the data related to the problem rather than deleting every Xcode folder at once.
Conclusion
To clear Xcode safely, start with the least destructive option: use Clean Build Folder for a project build reset, or remove the relevant Derived Data when you need a deeper cleanup. Refresh package caches only when dependencies are causing trouble, erase simulator data only when you are ready to lose its contents, and review archives carefully because they may be valuable release records.
Always close Xcode before removing files, verify folder paths, and keep a backup of anything you may need later. A targeted cleanup can free storage and resolve common Xcode problems without putting your projects or release history at risk.
Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.