Is there anyway to reduce the disk space used to store the Xcode application? I only downloaded Xcode so that I could compile C and C++, so if possible I would like it to take up much less than the 9.22GB it requires right now. Perhaps there are optional portions I can uninstall?
Although it's not directly related to the Xcode app size. There are multiple places where you can delete files to free up some space.
1. Derived Data
Xcode keeps data about your projects which includes index, build output and logs. Go to
~/Library/Developer/Xcode/DerivedData/ and delete the folders for projects that you no longer need to keep this data around for.
2. iOS Device Support
Xcode is storing information about the devices you have used for development. Delete the data no longer needed in
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 are stored under
~/Library/Developer/CoreSimulator/Devices. For each version of iOS you are building for.
5. Documentation Browse and delete unnecessary data under
Perhaps a more elegant solution would to be use the command line tools instead of Xcode.
You could delete Xcode entirely (or skip the install). Instead of downloading and installing Xcode - open the command line (terminal app works out of the box) and type gcc.
That will pop up a window where you can install the command line tools. Click install, click agree and the C compilers and libraries and debuggers will all download and install.
On 10.11 the command line tools take about 200 MB of disk space. The dmg to install the Xcode 9 version beta command line tools is less than that as well, so it’s a pretty slim set of tools if you want to preserve disk space and can use another IDE / editor and don’t need all the features Xcode provides.