- SimCleaner
- Guides
- Previews and test clones
SwiftUI Preview devices and XCTest clones
Xcode makes its own simulators for SwiftUI Previews and clones simulators for parallel tests, out of sight. Two commands remove them, and Xcode makes new ones when it needs them.
xcrun simctl --set previews delete all and xcrun simctl --set testing delete all; Xcode makes new ones when it needs them.SwiftUI Preview devices
To render previews, Xcode boots simulators of its own in ~/Library/Developer/Xcode/UserData/Previews/Simulator Devices. They collect app builds and data like any simulator, and developers have reported this folder at 110 GB and even 165 GB (forum thread). An Apple developer tools engineer gave this command for clearing them (forum reply):
xcrun simctl --set previews delete allOne developer went from 110 GB to 6 GB with it. Xcode 27 also shuts down preview simulators it no longer uses (release notes), which helps memory, not disk.
Parallel test clones
When tests run in parallel, Xcode clones a simulator several times into ~/Library/Developer/XCTestDevices. Test runs and coding agents can leave hundreds of them:
xcrun simctl --set testing list
xcrun simctl --set testing delete allDon't expect to get their listed size back. A clone shares its blocks with the simulator it was made from (APFS clones take "no additional space on disk" until they change; Apple), so the folder sizes overstate it. In one report, deleting 57 GiB of clones freed 3.3 GiB (source).
Playgrounds
Playgrounds have their own set too, in ~/Library/Developer/XCPGDevices, reachable with --set playgrounds.
Check sizes first
du -sh "$HOME/Library/Developer/Xcode/UserData/Previews" \
"$HOME/Library/Developer/XCTestDevices" \
"$HOME/Library/Developer/XCPGDevices" 2>/dev/nullWith SimCleaner
SimCleaner lists Preview devices and test clones next to your simulators, labelled Previews and Test clone, with what deleting each frees: the least and the most, when blocks are shared.
Questions
Will previews stop working?
No. The next preview takes a little longer while Xcode sets up a new simulator.
Can I stop Xcode from creating test clones?
Turning off parallel testing in the scheme's test settings stops the cloning; tests then run one simulator at a time.