Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xcode Hygiene

A small, dependency-free cleanup guard for Xcode development machines.

It reports Xcode storage without changing anything by default. Destructive actions require both --apply and an explicit category. The script never touches archives, provisioning profiles, app containers, recovery copies, or physical-device support.

Why

Xcode can quietly accumulate DerivedData and several multi-gigabyte simulator devices. This tool was extracted after a real cleanup recovered about 22 GB while preserving the one iPhone simulator, one Watch simulator, current device support, signing profiles, and application data that were still useful.

Preview

./xcode-hygiene.sh

Preview a specific cleanup:

./xcode-hygiene.sh \
  --clean-derived-data \
  --delete-unavailable-simulators \
  --prune-simulators \
  --keep-simulator "iPhone 17" \
  --keep-simulator "Apple Watch Series 11 (46mm)"

The second command still changes nothing. It prints the devices that would be deleted.

Apply

Run the same command with --apply only after reviewing the preview:

./xcode-hygiene.sh \
  --apply \
  --clean-derived-data \
  --delete-unavailable-simulators \
  --prune-simulators \
  --keep-simulator "iPhone 17" \
  --keep-simulator "Apple Watch Series 11 (46mm)"

The script refuses to continue while xcodebuild or an XCTest runner is active. Simulator pruning also refuses to run unless every requested keep-name exists in the current device set.

Deliberately not automated

  • Archives: these may be the only reproducible signed release artifacts.
  • Provisioning Profiles: deleting them can break local-device installation.
  • iOS DeviceSupport: verify the physical device OS before deleting an older support directory.
  • Simulator app data you did not explicitly prune.
  • Project directories, backups, and app containers.

Verify

./tests/test.sh

Requires macOS, Xcode command-line tools, Zsh, and the system Python 3 shipped with Xcode.

License

MIT

About

Preview-first Xcode DerivedData and simulator cleanup for macOS

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages