I recently found out that my 128GB SSD drive was down to a measly 8GB or more, leaving so little space that I couldn’t even update Xcode. What to do? If you upgrade a hard disk, first of all, you have to spend money, after all, SSD disk is not cheap, second of all, the upgrade is a lot of trouble, dismantle and migrate the system and so on, especially time and energy, I really don’t want to mess around, can only find a way to clear some space.

How much space does Xcode need?

Xcode 12.5 is 11.7GB in size. However, when you try to install it, you will receive error messages unless you have at least 40GB of free space. But that 40GB is not the whole story. As you use Xcode, especially as you connect more devices running different OS versions, Xcode grows in size and can easily take up more than 40GB of space. So, “How much space does Xcode need?” The answer to that question. At least 40GB, but beyond that depends on how you use it.

How can I make Xcode take up less space

Every time you connect a device to one running a new version of Apple OS, even if it’s just a 0.1 upgrade, Xcode adds more data and gets bigger. Many developers have pointed out that no data seems to ever be deleted. So Xcode continues to grow. An effective way to reduce the amount of space used by Xcode is to remove data associated with older versions of the operating system that are no longer needed. But that’s easier said than done. That’s how you do it.

  1. In Finder, navigate to the Go to menu, and then select Go to Folder.
  2. Type: ~ / Library/Developer
  3. Look for a folder called iOS DeviceSupport and open it
  4. You’ll see that each version of iOS has a separate folder. Drag them all into the trash.
  5. Find the folder named iPad OS DeviceSupport in ~ / Library/Developer and repeat Step 4.
  6. Empty the trash.

You should have deleted several GIGABytes of data. The next time you connect to an iOS or iPad OS device and use Xcode, it will download the libraries needed to run the iOS or iPad OS version of that device. Therefore, there is no danger in deleting these folders

Same as above steps, the same app packaged generated file, you can delete the unwanted program package files: > ~ / Library/Developer/Xcode/Archives

Project of the index file, etc., can all deleted, or delete unused project, open the project again automatically generated: > ~ / Library/Developer/Xcode/DerivedData

You can also remove unwanted devices and emulators from Xcode at once.

  1. In Xcode, click the Window menu.
  2. Select device and emulator.
  3. Click the emulator you want to delete, and then select Delete.

You can also clear the cache associated with the project by opening it and pressing Command + Shift + K. This frees up some space and solves any problems you might encounter when the project crashes.

The last

If you also like my space is not enough and don’t want to upgrade the hard disk, to see your ~ / Library/Developer/Xcode/folder, hopefully should also have a surprise.