What is Xcode's Previews folder on Mac? Is it safe to delete?
Yes, it is safe to clear. The Previews folder holds a separate set of simulators that Xcode uses only for SwiftUI previews, and Xcode creates them again the next time you open a preview.
Where it is
~/Library/Developer/Xcode/UserData/PreviewsWhat it is
When you use the preview canvas in Xcode, the preview runs in a simulator. Xcode keeps those preview simulators apart from the ones you see in the device list, in ~/Library/Developer/Xcode/UserData/Previews, inside a folder called Simulator Devices.
Each preview device is a full simulated file system, like the ones in CoreSimulator/Devices. A new one is created for each device type and runtime you preview on.
It grows because nothing removes preview devices for runtimes or device types you have stopped using, and they do not appear in Xcode's Devices and Simulators window.
How big it gets
From a few hundred MB to many GB, depending on how many device types and OS versions you have used for previews.
How to clear it by hand
- Quit Xcode so that no preview is running.
- Run the command below. It deletes every simulator in the separate device set Xcode uses for previews. Your normal simulators are not touched.
- Open Xcode again. The first preview takes longer while Xcode creates a new preview device.
xcrun simctl --set previews delete allWhat happens afterwards
The first preview after clearing is slower, because Xcode has to create and start a new preview simulator. Your projects, your regular simulators and the rest of UserData, such as snippets and key bindings, are unchanged.
How Diskzy handles it
Diskzy counts this folder with developer data under System Data and shows its size on the disk map, next to DerivedData and the other Xcode folders the Clean up tab lists.
Related guides
- CoreSimulator Devices~/Library/Developer/CoreSimulator/Devices
- DerivedData~/Library/Developer/Xcode/DerivedData
- CoreSimulator Caches~/Library/Developer/CoreSimulator/Caches
- Xcode simulator runtimes/Library/Developer/CoreSimulator/Volumes
See where your Mac's space went
Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.
Try Diskzy for free