Skip to content
86% off$349 $48.86code BF2026

Guides

How to Clear Xcode Cache and DerivedData on Mac

Clear Xcode's DerivedData, Device Support, simulators and previews safely: exact paths, what regenerates, xcrun simctl commands, and which Archives to keep.

GuideUpdated 9 min read

On this page

To clear Xcode's cache, quit Xcode and open Finder. Choose Go ▸ Go to Folder (⇧⌘G, Command-Shift-G), paste ~/Library/Developer/Xcode/DerivedData, move everything inside to the Trash, then empty the Trash. Xcode rebuilds DerivedData on the next build, so the only cost is a slower first build and a fresh round of indexing.

DerivedData is often the biggest single folder, but it isn't the only one. Device Support, old simulators, runtimes, SwiftUI previews and Archives add up too. Below is every location, whether it comes back on its own, and how to clear it.

Where Xcode stores caches and build products

All of these live in your home folder's Library, which Finder hides by default. Go ▸ Go to Folder opens any of them directly.

WhatPathComes back on its own?Safe to clear?
DerivedData (build products and indexes)~/Library/Developer/Xcode/DerivedDataYes, on the next buildYes, with Xcode quit
Xcode's own cache~/Library/Caches/com.apple.dt.XcodeYesYes, with Xcode quit
iOS Device Support~/Library/Developer/Xcode/iOS DeviceSupportYes, when that device next connectsYes, mainly old OS versions
watchOS Device Support~/Library/Developer/Xcode/watchOS DeviceSupportYes, when the watch next connectsYes, mainly old OS versions
Archives~/Library/Developer/Xcode/ArchivesNoOnly builds you no longer support
SwiftUI Previews~/Library/Developer/Xcode/UserData/PreviewsYes, when you open a previewYes, with Xcode quit
Simulator caches~/Library/Developer/CoreSimulator/CachesYesYes
Simulator devices~/Library/Developer/CoreSimulator/DevicesNo, apps and data in them are lostDelete through Xcode or xcrun simctl, not Finder
Simulator runtimesManaged by XcodeOnly if you download them againRemove in Xcode's Settings (see below)
Swift Package Manager cache~/Library/Caches/org.swift.swiftpmYes, on the next package resolveYes

To see which of these is large on your Mac, run this in Terminal. It only reads sizes and changes nothing:

bash
du -sh ~/Library/Developer/Xcode/* ~/Library/Developer/CoreSimulator/* 2>/dev/null

du counts in binary units (1 GB = 1024 MB), so its totals read slightly lower than Finder's.

Delete DerivedData in Xcode or Finder

Clean one project from inside Xcode

Choose Product ▸ Clean Build Folder (⇧⌘K, Command-Shift-K). This removes build products for the open project only. Other projects' DerivedData folders stay where they are, so it rarely frees much space. Use it to fix a confused build, not to reclaim disk space.

Delete all DerivedData in Finder

  1. In Xcode, choose Xcode ▸ Settings… and click Locations.
  2. Click the small arrow next to the Derived Data path. Finder opens the folder, which is the right one even if you or your team changed the location.
  3. Quit Xcode.
  4. In Finder, select everything inside DerivedData.
  5. Press ⌘⌫ (Command-Delete) to move it to the Trash.
  6. Empty the Trash.

Each project has its own folder, named after the project plus a hash. To clear only one project, trash just that folder.

Delete DerivedData from Terminal

This deletes permanently and skips the Trash. Quit Xcode first.

bash
rm -rf ~/Library/Developer/Xcode/DerivedData

This removes the whole DerivedData folder, and Xcode creates it again on the next build. Nothing is lost except build products and indexes. If you set a custom Derived Data location in Xcode, use that path instead.

iOS and watchOS Device Support

When you connect an iPhone or Apple Watch for debugging, Xcode copies that OS version's debug symbols into iOS DeviceSupport or watchOS DeviceSupport. Each OS version gets its own folder, and Xcode doesn't clean up old ones, so they pile up over years of updates.

  1. Quit Xcode.
  2. Open ~/Library/Developer/Xcode/iOS DeviceSupport with Go ▸ Go to Folder.
  3. Move the folders for OS versions no test device runs anymore to the Trash.
  4. Repeat in watchOS DeviceSupport.

Deleting the folder for a device you still use does no harm. Xcode copies the symbols again the next time that device connects, so expect a wait before you can debug on it.

Archives: what to keep

Archives are the one Xcode folder you should not clear blindly. Each .xcarchive holds the app build and its debug symbols (dSYMs), which you need to symbolicate crash reports from that exact build. They don't regenerate: a later rebuild of the same code produces a binary with a different UUID, so its symbols won't match crash reports from the original.

Keep archives for:

  • every version still in users' hands, on the App Store or in TestFlight
  • any build you might need to debug a crash report from

Usually safe to delete:

  • old internal test builds and betas that nobody runs anymore
  • duplicate archives of the same version

To review them, open Window ▸ Organizer in Xcode and select Archives. Right-click an archive to delete it or show it in Finder. On disk they sit in date-named folders under ~/Library/Developer/Xcode/Archives.

To keep the symbols but drop the rest, right-click the .xcarchive in Finder, choose Show Package Contents, and copy its dSYMs folder somewhere safe before deleting the archive.

Delete Xcode simulators: caches, unavailable devices and unused runtimes

Simulators take space in three ways, and each needs a different fix.

Simulator caches

~/Library/Developer/CoreSimulator/Caches holds dyld and runtime caches. CoreSimulator recreates them, so you can quit Simulator and move the folder's contents to the Trash.

Unavailable simulators

After an Xcode update, simulators built for runtimes you no longer have stay on disk as "unavailable" devices. Each one sits in ~/Library/Developer/CoreSimulator/Devices/<UDID> with its installed apps and data. Delete them all at once:

bash
xcrun simctl delete unavailable

This removes only simulators whose runtime is gone, and it can't be undone. You can create new simulators in Xcode at any time. To remove one specific simulator instead, use Window ▸ Devices and Simulators in Xcode, or run xcrun simctl delete <UDID>.

Unused simulator runtimes

Runtimes are the large downloads for each iOS, watchOS, tvOS or visionOS version. The easiest way to remove one is in Xcode: choose Xcode ▸ Settings…, open Components (called Platforms in Xcode 15), select a runtime you don't need and remove it. From Terminal, list them first:

bash
xcrun simctl runtime list

Then delete one by the identifier shown in that list:

bash
xcrun simctl runtime delete <identifier>

To undo, download the runtime again from the same Settings pane.

SwiftUI Previews

SwiftUI previews run in their own preview simulators and builds, stored in ~/Library/Developer/Xcode/UserData/Previews. The folder grows steadily if you use previews a lot. Quit Xcode, then move its contents to the Trash. Xcode recreates what it needs the next time you open a preview.

Clear Xcode cache and simulators in one place with Gigabroom

Doing all of this by hand means visiting six or more folders and running a few commands. Gigabroom, our disk cleaner, lists the Xcode and simulator locations on one screen with their sizes, a safety label and the reason for each. Everything you sweep goes to the Trash first, so you can put it back.

  1. Open Gigabroom and choose Developer Junk in the sidebar (⌘7).
  2. Look at the Xcode and Simulators sections. Xcode DerivedData, SwiftUI Previews and Simulator Caches are pre-selected because they come back on their own.
  3. Tick anything else you want to remove. iOS Device Support and watchOS Device Support are labelled Regenerates. Xcode Archives is labelled Review with the note "Needed to symbolicate crash reports of builds you shipped. Keep recent releases." None of these is pre-selected.
  4. Click Sweep in the footer (the button shows the total size).
  5. Confirm the dialog "Sweep N developer items to the Trash?". It also reminds you to quit Xcode and running builds first.
  6. Choose File ▸ Empty Trash… (⇧⌘⌫) to get the space back.

Before you empty the Trash or quit Gigabroom, Edit ▸ Undo Sweep (⌘Z) puts the items back where they were.

Developer Junk with the Xcode and Simulators sections expanded, each item with a Safe, Regenerates or Review label

How Gigabroom handles simulators:

  • Unavailable Simulators are listed with a Review label and can be swept (Gigabroom moves each device folder to the Trash). A booted simulator is never listed. Gigabroom reads this list with xcrun simctl, so it needs Xcode's developer tools; without them you see "Simulator details need Xcode (xcrun simctl). Simulator caches are still listed."
  • Unused Simulator Runtimes are report-only. Gigabroom shows them and lets you copy the xcrun simctl runtime delete command, but it never deletes a runtime itself.

The same screen covers package-manager caches (Homebrew, Swift Package Manager, CocoaPods, npm, Yarn, pip, Gradle, Cargo, Go) and node_modules folders. The Developer Junk docs list every path and label.

If you only want the items that regenerate, Quick Clean (⌘2) has Xcode DerivedData and Simulator Caches rows, and Smart Scan queues DerivedData, SwiftUI Previews and Simulator Caches along with other safe caches. Smart Scan never includes Archives or Device Support, and nothing moves until you confirm. Gigabroom is part of MacSuite; you can try it free for 7 days.

Compare the methods

MethodCoversGoes to the Trash firstCan't do
Xcode Clean Build FolderBuild products of the open projectNoOther projects, Device Support, simulators
FinderAny folder in the table aboveYesTell you which simulators are unavailable, remove runtimes
Terminal (rm, xcrun simctl)DerivedData, simulators, runtimesNo, permanentUndo
Gigabroom Developer JunkXcode, simulators, package caches, node_modules in one listYes, with Undo SweepDelete runtimes (copies the command instead)

How much comes back and when

The total depends on how many projects, devices and Xcode versions you've used. Run the du command above or open Developer Junk to get your own numbers. A few rules decide when the space actually shows up as free:

  • Moving to the Trash frees nothing yet. The space returns when you empty the Trash. If you empty it from Gigabroom, it reports the measured change in free space, not an estimate.
  • Local Time Machine snapshots can hold deleted data for a while. If free space barely moves after emptying the Trash, see why storage doesn't go down after deleting files and what purgeable space is.
  • DerivedData, previews and caches grow back as you work. Your next build is slower and indexing reruns. Clearing them is maintenance, not a one-time fix.
  • Device Support comes back only for devices you connect again.
  • Archives, deleted simulators and removed runtimes stay gone unless you rebuild, recreate or download them again.

To see how fast DerivedData refills, scan ~/Library/Developer in Gigabroom now and again a week later. What Grew (⌘6) then shows which folders grew between the two scans.

If it doesn't work

Free space didn't change. You moved items to the Trash but haven't emptied it, or a local snapshot still holds the data. Empty the Trash, then check again after a while.

DerivedData reappears straight away. Xcode was still open and started indexing again. Quit Xcode, clear the folder, then reopen Xcode.

Builds fail right after clearing. Xcode may still hold references to files you removed. Quit and reopen Xcode, run Product ▸ Clean Build Folder, and build again. If packages fail to resolve, choose File ▸ Packages ▸ Reset Package Caches.

xcrun: error: unable to find utility "simctl". Your active developer directory points to the Command Line Tools, not Xcode. Check it with xcode-select -p, then switch to Xcode (adjust the path if your copy has a different name, such as Xcode-beta):

bash
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

This changes which developer tools xcrun uses. To switch back, run the same command with the path xcode-select -p showed before.

Finder says an item is in use. Xcode or a simulator is still running. Quit both and try again.

FAQ

Does deleting DerivedData delete my code? No. Your source files live in your project folder. DerivedData only holds build output and indexes that Xcode creates from your code.

Can I delete all of ~/Library/Developer? Don't. It contains Archives you may need for crash reports and simulators with app data. Clear the folders in the table above one by one instead.

How often should I clear DerivedData? When disk space is tight or builds behave strangely. Clearing it more often only makes builds slower.

For package-manager caches, Docker and node_modules, see freeing up disk space as a developer. For app and browser caches outside Xcode, see how to clear cache on Mac safely.

Every app.
One purchase.