Fast Way to Make Xcode Use Less Disk Space

Dmytro Romaniuk
OmiSoft
3 min readSep 5, 2019

--

If you have been developing iOS or macOS apps for some time, you might have faced the situation when Xсode took a lot of disk space.

In this short article, I am going to show a quick way to clear the most consuming parts.

Here is the start point: Xcode takes almost 90GB.

Space for XCode before cleaning (a screenshot is taken from CleanMyMac)

The largest disk space consumers are:

  • Simulators
  • App archives (.xcarchive files)

So, we will clean them up a little bit.

1. Removing unneeded simulators

Consuming a lot of space, old simulators and runtimes are not removed by XCode automatically. In my case, I had more than 30 simulators installed.

The first way to remove them is to go to Window -> Devices and Simulators and click “delete” on each simulator that is not needed.

However, it can definitely take more time to delete each simulator separately, therefore there is a faster way, namely, via Command Line.

First, check the folder with runtimes:

cd /Library/Developer/CoreSimulator/Profiles/Runtimes

You will see several folders like these there:

iOS 10.2.simruntime
iOS 11.4.simruntime

Then delete runtimes which are not needed:

sudo rm -rf iOS\ 11.4.simruntime/

Next, to remove devices for runtimes that are no longer supported, run this command:

xcrun simctl delete unavailable

Voilà, we have +20 GB of free disk space! 🔥

2. Clearing archives

Each of the archives can take up to 500 MB or even more, and they are also not being cleaned automatically.

You can find archives grouped by date here:

‎⁨~/Library/Developer⁩/Xcode⁩

Afterwards, remove the older ones just via Finder or any other tool.

Results:

This was just a hotfix that takes less than 10 min. As a result, the Xcode size has almost halved from 90 GB to 50 GB.

Space for XCode after cleaning (a screenshot is taken from CleanMyMac)

However, there are also other parts that can be cleaned (e.g. cache, intermediate build information, etc.). So, this result could be much better.

To make a more precise cleaning, check out next resources:

Tap the 👏 button if you found this article useful!

About the Author
Dmytro is iOS & MacOS Developer at OmiSoft.

Are you in need of an iOS mobile app with clean & maintainable code? Click here to get an estimate!

--

--