Apple / Mac
How To Recover Disk Space from Xcode
sascha
I am working a lot on my 2012 Macbook Air 13″ enjoying the possibility of changing environments. This machine is actually my main computer, mostly due to the circumstances of living in Japan. Apartments are often small and coffee shops are very welcoming for people who want to get something done. Unfortunately the SSD in my Macbook Air is a bit too much on the small side with 256 GB. I was shocked this week when I had to find out that the free space was down to 3 GB.
I took some time to find out where all the free disk space has gone to and found that Xcode isn’t particularly good in cleaning up after itself. So here are a few places you can check in which Xcode is dumping a lot of dispensable data. Deleting no longer needed files from them helped me recover a whopping 36 GB of disk space.
Derived Data
Xcode keeps data about your projects which includes index, build output and logs. You can delete the folders for projects you no longer need to keep this information for.
Go to `~/Library/Developer/Xcode/DerivedData/` and delete the folders for projects that you no longer need to keep this data around for.
iOS Device Support
Xcode is storing information about the devices you have used for development. It does so anew for every new version of iOS, so depending on you history and the amount of devices you have connected to your development machine, this can make for a significant amount of data.
Delete the data no longer needed in `~/Library/Developer/Xcode/iOS DeviceSupport/`. Since this data is automatically generated by Xcode when you attach a device it’s not a big issue if you delete on that you find later to be needed again.
Archives
Over the time you might have accumulated a significant amount of archives. Either created for beta testers or actual App Store submissions.
Delete the one’s you don’t need in the Organizer, or go to `~/Library/Developer/Xcode/Archives/` to delete them in bulk. Be careful not to delete archives for which you still need the dSYM data for debugging.
Simulators
iOS 8 simulators are stored under `~/Library/Developer/CoreSimulator/Devices`. For each version of iOS you are building for. The simulators are represented by UUIDs. Different folders per device and iOS version. Which folder belongs to which device and version can be easily seen in the file `.default_created.plist`.
Simulator data prior to iOS 8 can be found at `~/Library/Application Support/iPhone Simulator/`.
Documentation
If your Xcode installation has been around for a while it might have also stored DocSets for older versions you are not going to work with anymore.
Browse and delete unnecessary data under `~/Library/Developer/Shared/Documentation/DocSets`.
Organizer
Some of the data mentioned about can also be deleted via Xcode’s Organizer application. However, often deletion can only be done one item at a time, which can become quite a tedious task. But it might be worth having a look around.