Home/Q&A/Build machine disk full of DerivedData and artifacts: how to clean it up

Build machine disk full of DerivedData and artifacts: how to clean it up

Updated · airankrush

Direct answer

Yes, it can be cleaned. Work through derived data, archives, simulators, old Xcode versions and the runner work folder in order of size. The first few are rebuilt automatically after deletion; for archives, confirm they are saved elsewhere first.

Basis

  • ~/Library/Developer/Xcode/DerivedData: intermediate build products and indexes, usually the largest chunk. Deleting all of it is safe; the price is that the next build is a full build.
  • ~/Library/Developer/Xcode/Archives: the .xcarchive produced by each archive, containing symbol files. Versions that have shipped will still be needed to symbolicate crash logs later, so confirm they are uploaded or saved elsewhere before deleting.
  • ~/Library/Developer/CoreSimulator: simulator device data and runtimes. xcrun simctl delete unavailable deletes devices the current Xcode can no longer use. Runtimes for old OS versions you no longer test can be removed in Xcode's settings.
  • Others: each additional Xcode version takes a large chunk of space; the runner's _work folder keeps a checkout and build outputs for each repository; brew cleanup clears old Homebrew versions; for container images, use docker system prune.

Information as of .

Boundaries: when the answer is different

All of this is cleaning up your own files. Do not delete system folders you do not recognize, or the platform's management and remote control components, to free up space. Cleanup only eases the problem. If the project itself needs several Xcode versions and several sets of simulators kept at once, enough disk capacity should have been chosen when ordering. External storage requires arranging purchase and delivery with support first; you cannot simply mail a drive in and use it. The build machine should not be the only place artifacts are stored: app packages and archives should be uploaded after every build, so that you can clean up without hesitation.

How to do it

  1. In Terminal, use du -sh ~/Library/Developer/* to see which category is largest. Do not delete by guesswork.
  2. Confirm the archives you need are saved elsewhere, then clear out the expired part of the archives folder.
  3. Delete derived data and run xcrun simctl delete unavailable.
  4. Uninstall old Xcode versions and simulator runtimes you no longer use.
  5. Put the cleanup above into a script, let a nightly job run it regularly, and send a notification when free disk space falls below a threshold you set.

Use case

This question belongs to the use case: Rented Mac mini as an always-on build machine for small teams? Count your build minutes first

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A