~/yoloabdo

Developer tools · macOS

Is Xcode DerivedData safe to delete? Every folder in ~/Library/Developer

Yes, for DerivedData. Other Xcode folders are not as safe. Here is each folder, what you lose, and the exact command.

A folder map of ~/Library/Developer with a colored dot and a size for DerivedData, Archives, iOS DeviceSupport, simulator devices, SwiftPM cache, CocoaPods cache and simulator runtimes.
Where the space goes on one Mac. Green is safe. Amber needs a check. Red is never a job for rm.

Yes, Xcode DerivedData is safe to delete. It holds build products, indexes and caches. Xcode makes them again when you build. You lose only time, because the next build is slower (if you step away during long clean builds, Nightcap Awake keeps your Mac awake while Xcode builds, or compare Nightcap Awake vs Amphetamine and KeepingYouAwake). Quit Xcode first.

Developers say the same in the accepted answer on the Apple Developer Forums. Some other folders are different. Archives hold crash symbols. Simulator runtimes can come back after you delete them. This guide covers each one. It also has one tool that does the review for you: DiskSage, my open source Mac app.

How to clear the Xcode cache: measure first

Do not delete anything before you know where the space is. This command prints sizes and deletes nothing:

Terminal output of du -sh for DerivedData, Archives, iOS DeviceSupport, CoreSimulator Devices, the SwiftPM cache and the CocoaPods cache, then xcrun simctl runtime list showing 13 disk images and 79.1G.
Real output from my Mac with Xcode 27.2 on 21 November 2026. The runtimes are the largest item.

Simulator runtimes are disk images. du does not show them well, so I use xcrun simctl runtime list and read the last line.

Every folder in ~/Library/Developer: is it safe to delete?

Traffic-light chart: is it safe to delete? DerivedData, caches and old DeviceSupport are green. Simulator devices and Archives are amber. Simulator runtimes are red.
One verdict for each folder.

Swipe or scroll the table sideways to see every column. Check a size with du -sh <path> before you delete.

Xcode folders and caches: what each one is, the risk, and the command. Quit Xcode first.
FolderWhat it isSafe?What you loseCommand
DerivedDataBuild products, indexes, module caches and package clonesYesBuild time. Xcode makes it again.rm -rf ~/Library/Developer/Xcode/DerivedData/*
UserData/PreviewsData for SwiftUI Previews, with its own simulator setYesPreviews start slowerxcrun simctl --set previews delete all
iOS DeviceSupportDebug symbols that Xcode copies from a connected deviceYes, for old versionsXcode copies the symbols again at the next connectrm -rf "$HOME/Library/Developer/Xcode/iOS DeviceSupport/<folder>"
ArchivesOne .xcarchive for each archive, with its dSYMsThink firstThe dSYMs of that buildXcode Organizer, or delete one .xcarchive
CoreSimulator/DevicesOne folder for each simulator: its apps and dataUse simctlInstalled apps and their dataxcrun simctl delete unavailable
Simulator runtimesOS disk images in /Library/Developer/CoreSimulatorNot by handA download of several GB, if you need it againxcrun simctl runtime delete <id>
SwiftPM cache~/Library/Caches/org.swift.swiftpmYesPackages download againswift package purge-cache
CocoaPods cache~/Library/Caches/CocoaPodsYesPods download againpod cache clean --all
Carthage cache~/Library/Caches/org.carthage.CarthageKitYesCarthage fetches it againrm -rf ~/Library/Caches/org.carthage.CarthageKit

Sources: the Apple Developer Forums thread on ~/Library/Developer (accepted answer and an Apple DTS engineer); the CocoaPods commands guide; xcrun simctl help and swift package purge-cache --help on my Mac.

Xcode DerivedData location and how to clear it

The default DerivedData location is ~/Library/Developer/Xcode/DerivedData. Each project has its own folder, named with the project name and a hash. To open the folder, run open ~/Library/Developer/Xcode/DerivedData. If you changed the location, look in Xcode Settings, Locations.

  1. Quit Xcode.
  2. To clear one project, delete its folder: rm -rf ~/Library/Developer/Xcode/DerivedData/MyApp-*.
  3. To clear all projects, run rm -rf ~/Library/Developer/Xcode/DerivedData/*.
  4. Open the project and build. The first build is slow. It makes the files again.

A command line option with a similar name is xcodebuild clean. It works on the build of the scheme that you name. It does not remove the whole folder. To clear the whole folder, delete it.

Your source files, project files and signing certificates are not in DerivedData. An older Apple forum thread says to close the project in Xcode before you delete its folder. I agree.

Delete old Xcode simulators and runtimes

Xcode has two things here. They are different.

  • Simulator devices are small folders in CoreSimulator/Devices. Each one holds the apps and data of one simulator.
  • Runtimes are the large OS images. On my Mac, 13 images use 79.1 GB.

Apple's DTS engineer says not to remove the CoreSimulator folder by hand. Use Xcode or simctl. To delete simulators that the current Xcode does not support, run xcrun simctl delete unavailable. Its help text says it deletes devices "not supported by the current Xcode SDK". I read this from xcrun simctl help delete.

Terminal commands to delete old Xcode simulators: simctl delete unavailable, simctl runtime list, simctl runtime delete with the outdated and dry-run flags, and delete with notUsedSinceDays.
The --dry-run flag prints what runtime delete would remove. It deletes nothing.

To delete a runtime in the app, open Xcode, Settings, Components. Select the runtime and click the minus button. Apple's DTS engineer describes these steps in this thread. Xcode shows how much space you get back.

The command line version is xcrun simctl runtime delete. These options come from xcrun simctl help runtime: an identifier, --notUsedSinceDays <days>, --unusable, --outdated, --dry-run and --keep-asset.

Why do runtimes come back after I delete them?

Some people report this. Runtime files can sit in a folder that macOS protects with SIP. One thread says deleted runtimes mount again after a restart. Another thread says Components also left files on disk. An Apple DTS engineer says that disabling SIP to remove them is not supported. One user says Xcode 27.2 beta 2 fixed it.

My advice: never use rm on these folders. Update Xcode, try Components, then try xcrun simctl runtime delete. If a runtime stays, file a report in Feedback Assistant.

Xcode Archives: keep the dSYMs

Each archive in ~/Library/Developer/Xcode/Archives includes the dSYM files of that build. A crash log needs the matching dSYM to show function names. If you delete the archive, you lose that dSYM. Crash logs from that build then show raw addresses.

If you uploaded the dSYMs to App Store Connect or to a crash service, you can delete the archive. If not, keep the archives of builds that users still run. DiskSage does not offer Archives for removal.

Xcode device support: delete old versions

iOS DeviceSupport holds symbols that Xcode copies when you connect a device. There is one folder for each OS version. Delete the folders of versions that you no longer use. Keep the newest one for each device. Xcode copies the symbols again if a device with an old version connects. This is the advice of the accepted forum answer.

Clear the SPM, CocoaPods and Carthage caches

  1. SwiftPM: run swift package purge-cache. The help text says: "Purge the global repository cache."
  2. Package clones of one project are in DerivedData/<project>/SourcePackages. They go when you delete that DerivedData folder.
  3. In a package folder, swift package reset resets the cache and build directory of that package.
  4. CocoaPods: run pod cache list to see it. Then run pod cache clean --all. The --all flag skips the question and is required when you give no pod name.
  5. Carthage: the Carthage docs say its cache holds bare Git repositories and prebuilt binaries. Carthage fills it again at the next checkout.

Do it with one review: DiskSage

The table above has nine rows and many commands. I built DiskSage to do the same job in one review. It is a menu-bar app for macOS 14 or later. It is free and open source under the MIT license.

The DiskSage banner: a green disk icon with a leaf, and the text Developer disk cleanup for macOS.
DiskSage, a developer disk cleanup app for macOS. Banner from the project repository.

For Xcode, DiskSage scans these places. Each item has a risk label and a reason:

  • DerivedData: compiled files, and whole project folders that did not change for some days. Low risk.
  • Older DeviceSupport versions: only when a newer version for the same device stays. Low risk.
  • Simulator devices: one at a time, only if shut down. Risk label: Review. The reason says that the apps and data go.
  • SwiftPM binary downloads and SwiftPM scratch folders. Low risk.
  • Other caches that developers fill: npm, Go, Bazel, Homebrew, uv and some Electron apps.

DiskSage does not offer Archives or simulator runtimes. Use the tools above for those. It skips files that changed in the last hour and files that a process has open. It never follows symlinks. A scan shows up to 100 of the largest candidates.

Illustration of the DiskSage Review window with Xcode DerivedData and DeviceSupport rows marked Low risk, a simulator marked Review, and a Delete Selected button.
Illustration with sample values, drawn from the README and the source. It is not a screenshot.

You choose the items. DiskSage asks you to confirm each manual deletion. It keeps a history and a local log at ~/Library/Logs/DiskSage/cleanup.jsonl. In Settings you can add keep rules for paths and for simulator names.

Read this before you install. Deletion is permanent. Items do not go to the Trash. Low-disk automatic cleanup is on by default, at 15 GiB of free space. It removes low-risk targets without a prompt. To start in review-only mode, run this before the first launch:

defaults write com.abdoeaita.DiskSage automaticCleanupEnabled -bool false

There is no notarized installer. You build it from source with Xcode 27, which is the tested toolchain:

git clone https://github.com/Abdo-codes/DiskSage.git
cd DiskSage
./Scripts/build-app.sh release
open .build/release/DiskSage.app

Local builds are ad-hoc signed. Click the menu-bar drive icon, scan, and choose Review items. DiskSage can also review Git worktrees and has an MCP server for Claude Code and Codex.

Terminal, Xcode, DevCleaner or DiskSage

Each way fits a different person. The table shows what each one does well.

Four ways to clean Xcode storage. DevCleaner facts come from its GitHub README.
WayBest atWeak atCost and install
Terminal by handFull control. Reaches runtimes and every cache with simctl and the tool commands.No risk label. One wrong path deletes the wrong thing. No history.Free. Built in.
Xcode settingsThe safe way to remove runtimes (Components). Apple supports it.Only runtimes and simulators. You still clear DerivedData and caches yourself. Reports of leftovers.Free. Built in.
DevCleaner for XcodeArchives, DeviceSupport, DerivedData, documentation cache and old logs, in one window.Its README lists no simulators or runtimes. It uses internal Xcode folder structures. It was tested on Xcode 15.Free, GPL-3.0. On the Mac App Store.
DiskSageOne review with a risk label and a reason for each item, a confirmation, history and keep rules. Also npm, Go, Homebrew and more.No Archives or runtimes. Permanent deletion. Automatic cleanup is on by default. Build from source.Free, MIT. Not notarized.

The README of DevCleaner says to make a backup before you use it. MacPaw's guide says CleanMyMac also clears Xcode junk and the iOS Simulator, with a free trial. I did not test either one. Use DevCleaner if you want Archives in the same window. Use DiskSage if you want one review across Xcode, package managers and agent folders.

Questions

Is it safe to delete Xcode DerivedData? Yes. Xcode makes it again when you build. The next build is slower. Quit Xcode first.

Will deleting DerivedData delete my project? No. Source files, project files and signing certificates are not in DerivedData. Package clones download again.

Where is DerivedData located? ~/Library/Developer/Xcode/DerivedData by default. You can change it in Xcode Settings, Locations.

Can I delete iOS DeviceSupport? Yes, for old OS versions. Xcode copies the symbols again when a device with that version connects.

Why do simulator runtimes come back after I delete them? Forum reports say some runtimes stay in a SIP-protected folder and mount again at restart. Update Xcode and use Components or simctl runtime delete. Do not use rm.

How do I clear the Swift Package Manager cache? Run swift package purge-cache. For one project, delete its DerivedData folder.

Keep reading

Guide · 21 Nov 2026

Git worktree remove: delete the folder, keep the branch

What remove, prune and --force do, with real output. Plus how to audit worktrees that AI agents leave.