Remove Xcode Junk from Mac OS X

Oftentimes we find ourselves in dire need of some extra disk space. Given the chance that you do a lot of iOS / Mac OS / WatchOS development some temporary junk can pile up over time – and given the size of your projects, it can eat away a considerable amount of your precious disk space.

These are the directories that are safe to be removed in terms of Xcode temporary files, but be warned: the Archives folder is suitable for debugging already deployed builds of your software, whereas the MobileSync should be deleted using the appropriate iTunes option within the Preferences. The author is not responsible for any damage that may be caused by or could be related to the deletion of these files.

With that said, these are the directories:

~/Library/Developer/Xcode/DerivedData
~/Library/Developer/Xcode/Archives
~/Library/Developer/Xcode/iOS DeviceSupport
~/Library/Developer/CoreSimulator
~/Library/Caches/com.apple.dt.Xcode
~/Library/Application Support/MobileSync/Backup

Upon first start, Xcode will re-generate everything that’s necessary.