Your Search Bar For Shrewd Tips

How Do I Clear Xcode Data?


If Xcode is taking up too much space, builds are behaving strangely, or a project seems stuck using outdated files, clearing selected Xcode data can help. The key is to remove generated files and caches—not your project, source code, or anything you still need. Xcode stores several kinds of data, including build products, archives, simulator files, and downloaded support files, so the best cleanup method depends on what you want to fix or free up.

This guide explains how to clear Xcode data safely, what each cleanup option removes, and how to avoid deleting valuable work. Before you start, quit Xcode and any Simulator windows. If you are unsure whether a folder contains something important, inspect it before deleting it.

What Does “Xcode Data” Include?

Xcode uses the term “data” to describe files created or downloaded while you develop apps. Some files are temporary and can be rebuilt. Others—such as archived app versions—may be important for testing, distribution, or future releases.

  • Derived Data: Build output, indexes, logs, and other files Xcode generates for projects. It is usually safe to remove; Xcode recreates what it needs.
  • Archives: Packaged builds stored for distribution, testing, or submission. Keep archives you may need later.
  • Simulator data: Simulated devices, installed apps, and their data. Removing it may delete test data and sign-in states.
  • Device support files: Files Xcode uses to work with connected Apple devices and particular operating system versions.
  • Package and download caches: Cached dependencies and platform components. Some may need to be downloaded again after cleanup.

These files are separate from your project’s source code, but not every item labeled as Xcode data is disposable. Choose a targeted cleanup before removing large folders wholesale.

Clear Derived Data in Xcode

Derived Data is a common first choice when you want to reclaim disk space or troubleshoot stale build results. Clearing it does not normally remove your project files. The next build may take longer because Xcode has to rebuild products and refresh its index.

To remove Derived Data using Xcode:

  • Open Xcode and choose Window > Organizer, or open the project settings and find its build location, depending on your Xcode version.
  • In recent Xcode versions, open Xcode > Settings > Locations and look for the Derived Data location.
  • Use the folder or arrow control beside the location to open it in Finder.
  • Quit Xcode, then move the relevant project folder or the contents of the Derived Data folder to the Trash.
  • Empty the Trash only after confirming you do not need to restore anything from it.

The usual default location is ~/Library/Developer/Xcode/DerivedData. The tilde represents your Mac’s home folder. If you changed the location in Xcode settings, use the configured path instead. You can open the default folder from Finder by choosing Go > Go to Folder and entering the path.

For a single project, deleting only that project’s Derived Data folder is a narrower cleanup. To clear all Derived Data, remove the contents of the folder while Xcode is closed. Avoid deleting your project directory by mistake: Derived Data is a separate Xcode storage location, not normally the folder where you keep your code.

Clear Derived Data with Terminal

If you are comfortable using Terminal, you can open the Derived Data folder with a command instead of browsing through Finder. This command opens the default location:

open ~/Library/Developer/Xcode/DerivedData

Review the folder in Finder and delete the project folders you intend to clear. Using Finder gives you a chance to inspect the files and use the Trash as a recovery step. Be cautious with commands that permanently remove files, especially commands containing rm -rf. A typo or incorrect path can delete unrelated data, and files removed this way may not be recoverable from the Trash.

Remove Old Xcode Archives

Archives can consume substantial storage because they contain packaged app builds. Unlike Derived Data, an archive may be the only convenient copy of a particular release build. Check its date, project, and intended use before removing it.

To review archives, open Xcode and choose Window > Organizer, then select the archives section. Select an archive to inspect its details. If you no longer need it, use the delete control in Organizer. You can also review the default archive folder in Finder at ~/Library/Developer/Xcode/Archives, but the Organizer makes it easier to identify what each archive is for.

Keep archives that you may need for app distribution, troubleshooting, or reproducing a release. If you delete an archive, you can usually create a new one from the project, but you may not be able to recreate the exact original build if the code or build settings have changed.

Clean Up iOS and watchOS Simulators

Simulator storage includes virtual devices, their operating system runtimes, and data saved inside simulated apps. Removing a simulator device can free space, but it also removes its installed apps and local test data. Save anything you need before resetting or deleting a device.

Open the Simulator app and use its menus to manage devices, or open Xcode’s device management interface through Window > Devices and Simulators. Remove simulator devices you no longer use. If you are troubleshooting one simulator, erase its contents and settings rather than removing every device. This gives you a clean test environment while leaving other simulators untouched.

Simulator runtimes can also take up significant space. Review installed platform components in Xcode settings, usually under Platforms or a similarly named section, and remove runtimes you no longer need. Menu labels can vary between Xcode releases. Do not delete simulator folders manually unless you understand what they contain; removing the wrong files can leave simulator management in an inconsistent state.

Remove Unused Device Support Files

Xcode may store support files for operating system versions on connected iPhones, iPads, and other Apple devices. These files help Xcode communicate with devices and support debugging. They may be recreated or downloaded again when needed, but deleting them can mean waiting while Xcode prepares a device the next time you connect it.

Check the available storage through Xcode’s device management tools before attempting a manual cleanup. The default device support location is ~/Library/Developer/Xcode/iOS DeviceSupport. Inspect it rather than deleting the entire folder without checking. If you remove files, keep support data you need for devices or operating system versions you actively use, and ensure Xcode is closed first.

Clear Package and Build Caches

Projects that use Swift Package Manager or other dependency tools may store downloaded packages and cached build results. If a dependency appears stuck on an old version, first try the project’s built-in package controls. In Xcode, open the project and choose File > Packages > Reset Package Caches if that option is available. Then resolve packages again if necessary.

Be aware that resetting caches can trigger new downloads and may take time, particularly on a slow connection. It does not replace checking your project’s dependency declarations or version settings. If a build problem continues, try resolving packages or reviewing the project’s package configuration before removing unrelated Xcode files.

Derived Data cleanup also removes many project-specific build artifacts and indexes, so it may address some build-cache problems. Avoid deleting unknown folders in your Library just because their names include “cache.” Some belong to other developer tools or applications, and some contain data you may not want to recreate.

Remove Downloaded Xcode Platforms and Components

Xcode may download platform support, simulator runtimes, or other optional components. If you no longer develop for a particular platform, open Xcode’s settings and review the platform or component management section. Remove only components you recognize and do not currently use. You can download supported components again later, but doing so requires an internet connection and additional time.

If your goal is to free a specific amount of space, check your Mac’s storage settings before and after cleanup. Storage estimates may take a while to update. You can also compare the sizes of relevant folders in Finder using Get Info. This helps you focus on the largest safe targets instead of deleting small caches that make little difference.

What You Should Not Delete

Do not treat every folder containing “Xcode” or “Developer” as disposable. Before removing files, distinguish Xcode’s generated data from your own work and from tools shared by other development workflows.

  • Do not delete your project folder, source files, assets, or local changes to save Xcode storage.
  • Do not remove archives you need for a release, distribution, testing, or record keeping.
  • Do not erase simulator devices that contain test data you have not backed up.
  • Do not delete folders from /Applications or your Library without confirming exactly what they contain.
  • Do not run broad, copied Terminal deletion commands unless you understand the path and the effect.

If you are concerned about losing work, make a backup before cleaning up. Commit or otherwise save project changes, and copy important archives or test data to a separate location. A backup is especially useful before removing large folders or resetting simulator devices.

Which Xcode Cleanup Should You Choose?

Use the smallest cleanup that addresses your problem. If a project has stale build results, remove that project’s Derived Data. If you need disk space, review Derived Data and old archives first, then check unused simulator devices and runtimes. If package resolution is failing, try Xcode’s package reset and resolution options before manually deleting caches. If a simulator behaves incorrectly, erase that simulator rather than clearing all Xcode data.

After cleanup, reopen Xcode and build the project again. The first build may be slower while Xcode recreates files or downloads dependencies. If the problem remains, check the project’s build settings, package versions, available disk space, and Xcode version. Repeatedly clearing every folder is not a substitute for identifying the underlying issue.

Conclusion

You can clear Xcode data safely by targeting the files that match your goal. Derived Data is generally safe to rebuild, while archives, simulator contents, device support files, and downloaded platforms deserve a closer review before deletion. Quit Xcode, confirm the storage location, remove only what you recognize, and keep backups of anything you may need. A careful cleanup can free disk space and resolve common build problems without putting your source code or release files at risk.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →