60

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?

2 Answers 2

68

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 ~/Library/Developer/Xcode/iOS DeviceSupport/.

3. Archives 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.

4. Simulators 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 ~/Library/Developer/Shared/Documentation/DocSets.

1
  • 2
    I only have 3 folders in Xcode: DerivedData,iOS Device Logs, and UserData. The first two folders are zero KB, and UserData is only 8KB. I do not have a CoreSimulator folder in Developer. I already deleted the DocSets, which were taking up an additional ~2.5GB on top of the 9.22 that Xcode is using.
    – spacetyper
    Jun 19, 2017 at 16:26
23

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.

4
  • 2
    Many programs actually need the full Xcode to run correctly.
    – Tea Tree
    Feb 15, 2021 at 15:16
  • 1
    Wow @TeaTree what sort of programs? That’s a pretty huge dependency to need installed, but if you are a developer, maybe that is why.
    – bmike
    Feb 15, 2021 at 15:54
  • 1
    Deadbeat for example but what really makes me think so is that whenever I run into a problem with gcc, what fixes it is to install the complete Xcode.
    – Tea Tree
    Feb 15, 2021 at 22:52
  • Aah @TeaTree that makes sense if you have to get the source code and make your own build of the application. Good example for sure.
    – bmike
    Jul 21, 2022 at 20:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .