If you have been developing for iOS on your Mac for a while, chances are you can free up some of your precious SSD space with no pain.

How much available space can you get back? Up to tens of GBs, depending mainly on how long you have been developing for iOS…

What is taking all that space on my SSD?

There are many advanced apps to give you an overview of your SSD usage. However, you can get a lot of insights with a simple shell command:

du -hs ./* | sort -h

How it works:

  • Show disk usage (du) of all folders and files in current directory (./*), show total summary for each item (-s) in human-readable format (-h).
  • Sort output (sort) by numeric value taking into account human-readable format (-h).

Run it every now and then inside your home folder and just follow the trail of too big folders from there, going deeper.

I did just that to find iOS development related resources I could delete…

How do I get my SSD space back?

Your Mac contains a lot of folders, spreaded across filesystem, containing resources related to iOS development. Many of those can contain resources which you might not need anymore. This article will give you an overview of some of these folders. It is then up to you to decide what to delete… I don’t take any responsibility for any eventual damage or loss!

Before you delete anything from these locations, you should close Xcode and iOS Simulator, just in case…

Note on using Time Machine

If you are using Time Machine backups, you might not see the free space immediately after deleting files. From my experience, Finder does not show extra free space after deleting files until next Time Machine backup was finished.

You could also consider excluding some of the locations mentioned in this article from your Time Machine backups. That could speed up your backups and save you some backup disk space. Most of these locations are anyway either caches or can be downloaded again.

DerivedData

Location: ~/Library/Developer/Xcode/DerivedData (default)

Everyone knows DerivedData folder. It contains artifacts and caches / temporary files for each build. Deleting it is usually the first thing we do when facing unexpected build failures.

Deleting contents of DerivedData is safe and it can get a lot of space back, depending on how many projects you have built since it was empty last time. Be aware that after deleting DerivedData you will have to rebuild each project from scratch.

iOS Simulator runtimes

Location: /Library/Developer/CoreSimulator/Profiles/Runtimes

Each Xcode comes with preloaded Simulator for latest iOS version. You can install additional Simulators in Xcode -> Preferences -> Components. Every additionally installed Simulator is here.

You can safely delete any Simulator version you don’t need anymore. Don’t worry, you can always re-install it again from Preferences.

$ cd /Library/Developer/CoreSimulator/Profiles/Runtimes/
$ du -hs ./*
3.8G	./iOS 10.0.simruntime
4.0G	./iOS 10.3.simruntime
3.8G	./iOS 11.0.simruntime
2.5G	./iOS 8.1.simruntime
2.8G	./iOS 8.3.simruntime
3.1G	./iOS 9.0.simruntime
3.2G	./iOS 9.3.simruntime

As you can see, these are taking quite a lot of space. In my case deleting everything pre-iOS 10 would give me back 11+ GB.

iOS DeviceSupport

Location: ~/Library/Developer/Xcode/iOS DeviceSupport/

Check rmaddy’s answer at StackOverflow explaining contents of this folder. Quoting the answer:

The ~/Library/Developer/Xcode/iOS DeviceSupport folder is basically only needed to symbolicate crash logs.

You could completely purge the entire folder. Of course the next time you connect one of your devices, Xcode would redownload the symbol data from the device.

Deleting contents of this folder from time to time can give you a lot of space back. Depending on the amount of devices you were connecting to your Xcode, it can be up to tens of GBs (as you can see in StackOverflow comments).

$ cd  ~/Library/Developer/Xcode/iOS\ DeviceSupport/
$ du -hs ./* | sort -h
781M	./8.1 (12B410)
1013M	./9.2 (13C75)
1.3G	./10.1.1 (14B100)
1.9G	./11.1.2 (15B202)
2.9G	./10.3.3 (14G60)

CoreSimulator logs

Location: ~/Library/Logs/CoreSimulator

iOS Simulator saves logs to this folder. Deleting logs should be safe.

$ cd ~/Library/Logs/CoreSimulator
$ du -hs ./* | sort -h | tail -n 5
 35M	./5467D1F1-C5AA-4960-B05A-1D2426668FA1
 43M	./B7B06CF9-6E60-4EE3-A859-65F934053220
 50M	./A960D4D9-EFDA-421A-8497-F6061B6A4D21
 64M	./3B8C532C-8247-4654-A1F8-677D3D0EE53C
5.2G	./CoreSimulator.com.apple.Safari.log

Logs folder might not sound interesting, but eventually could take a lot of space. Simulator’s Safari log taking over 5GB was very surprising to me…

Xcode Downloads cache

Location: ~/Library/Caches/com.apple.dt.Xcode/Downloads

This is a temporary location of all Xcode downloads. When installing additional Simulators from Xcode -> Preferences -> Components, Xcode first downloads installer .dmg here and then installs Simulator from it. Installers seems to be kept even after the installation. Once the Simulator is installed, should be safe to delete these installers.

$ cd ~/Library/Caches/com.apple.dt.Xcode/Downloads
$ du -hs ./* | sort -h
228M	./Xcode.Symbols.Watch1,2.15U70-4.3.2.dmg
1.2G	./com.apple.pkg.iPhoneSimulatorSDK8_2-8.2.1.1434581536.dmg
1.8G	./com.apple.pkg.iPhoneSimulatorSDK10_0-10.0.1.1474488730.dmg
2.0G	./com.apple.pkg.iPhoneSimulatorSDK11_0-11.0.1.1508875951.dmg
2.0G	./com.apple.pkg.iPhoneSimulatorSDK11_4-11.4.1.1527703358.dmg

Xcode Archives

Location: ~/Library/Developer/Xcode/Archives

Archives from Xcode -> Window -> Organizer -> Archives are stored here. These are .xcarchive packages of our application, result of Xcode -> Product -> Archive, most often ready for submission to App Store Connect. You can eventually have archives you don’t need anymore.

WARNING: If you want to delete archives, be extremely careful. Be absolutely sure you want to do that and that it cannot cause you any harm. Archives, among others, contain dSYMs you need for symbolicating your crash reports (from my experience these are sometimes needed even if you use Bitcode and download dSYMs from App Store Connect).

Speaking of which, as a best practice, you should consider always backing up your archives somewhere outside your Mac.

Carthage DerivedData

Location: ~/Library/Caches/org.carthage.CarthageKit

Carthage dependency manager seems to store its DerivedData in Caches, not the standard ~/Library/Developer/Xcode/DerivedData location.

If you are using Carthage, you might get some space by deleting its DerivedData and additionally other folders. Be aware that next time you will call carthage update, it will take some time as it will rebuild (and eventually re-download) all dependencies.

$ cd /Users/lukas.kukacka/Library/Caches/org.carthage.CarthageKit
$ du -hs ./* | sort -h
 56M	./dependencies
 67M	./binaries
1.5G	./DerivedData

Did you get your available space back?

I hope this article gave you a good overview of where Xcode stores various disposable files and maybe helped you to get some available SSD space back.

How much space did you get back? Do you know any other locations this article should mention? Let me know via Twitter ↓