David Cordero

How to free up space in your CI or iOS Development machine

Published on 01 Oct 2019

As a result of working in iOS Development, it is quite common to see how your machine eventually run out of space.

The reason is that, as things go, some files like archives, simulators, or caches from building are created, but never deleted.

Here you can find some ways to recover some space on your disk.

Delete unnecessary device simulators

After some time you can end up with a very long list of old simulators, which are even no longer supported by your version of Xcode. Using the following command you can get rid of these simulators and the space in the disk that they take:

xcrun simctl delete simulators

Delete derived data

Derived Data contains caches generated and used by Xcode. From time to time (more often than desired) Xcode gets crazy and the content of DerivedData gets corrupted.

With the following command you can delete the Derived Data:

rm -rf ${HOME}/Library/Developer/Xcode/DerivedData

Delete old archives

The folder Archives contains the results of archiving your App for deploy. On the machines used to generate the releases, this folder can grow a lot unless the builds are periodically removed.

To get rid of all those Archives you can make use of the following command:

rm -rf ${HOME}/Library/Developer/Xcode/Archives

Finding wasted disk space

Apart from the previous points, I find very useful a macOS application called OmniDiskSweeper. OmniDiskSweeper is a very simple application that shows your whole filesystem with the amount of data that each folder takes.

Using it, you can find some folders consuming more disk than expected.

Some examples that I found thanks to this tool are unused docker images, old android sdks, already exported iMovie projects or projects cloned from Github that I don’t longer need.