Clean your Mac for Xcode’s Users

How do I save 50 Gb from cleaning Xcode related data

Quang NGO
3 min readMay 16, 2020
Photo by Tianyi Ma on Unsplash

As you may already noticed, Xcode takes a lot of space on your hard drive. From time to time you could see warnings about low storage. Recently I had this problem and my first reflex is finding a script or an app to “clean” my Mac. It helps a bit but not much, since theses apps can only give you “safe” cleaning, typically removing caches data. They don’t “dare” to touch user’s data. After doing some research, I find out 50 Gb to delete from my Xcode related data, and I would like to share with you theses tips. Theses actions are safe because you know what you do.

Xcode Caches

It’s safe to delete the folder com.apple.dt.Xcode because Xcode can recreate its caches (it could take some time at first relaunch, if Xcode need to re-download something).

The location of this folder is at ~/Library/Caches/com.apple.dt.Xcode

Derived Data

Contents of Derived Data folder is generated while Xcode builds your project, so it’s safe to empty it.

The location of this folder is at ~/Library/Developer/Xcode/DerivedData

Xcode Archives

Archives could take a lot of spaces. Since you always generate an archive for every release, over time it can cumulate to a big mountain. You can delete them by going to Organizer -> Archives tab -> right-click on the archive you want to delete -> Open in Finder -> remove the .xcarchive file

The location of this folder is at ~/Library/Developer/Xcode/Archives

Xcode Device Support

Remove the unneeded iOS’s version support from Xcode can save big space for your Mac (for example, the Device Support folder for iOS 13.1 takes about 3 Gb). This folder is basically needed only to symbolicate crash logs. If your work requires you to support iOS 11 and later, you can safely remove support folder for iOS 10.x and earlier.

The location of this folder are at ~/Library/Developer/Xcode/iOS DeviceSupport/

Simulator Data

Simulator’s user data can consume a lot of space. When you want to empty user’s data from a simulator, the official way is to use “Reset Content and Settings” option in Setting app on Simulator. But if you get tired of doing it one by one, you can empty the folder ~/Library/Developer/CoreSimulator Another handy command line xcrun simctl delete unavailable to delete unavailable simulator.

Additional Simulators

Sometimes you need to download additional simulator of older iOS versions to test your apps. But when you no longer need those simulators, it’s good idea to get rid of them. A simulator takes approximately same size as the iOS.

The location of this folder are at /Library/Developer/CoreSimulator/Profiles/Runtimes (be careful, the path is /Library, not ~/Library)

I hope theses tips help you to get some extra storage for your Mac. All the tips mentioned in this story are safe, because even you accidentally deleted something you still need, you can be able to regenerate or re-download it. Enjoy cleaning!

--

--

Quang NGO

iOS Engineer. Passionate in improving mobile development environment. Sharing best practices and how to do better programming