April 29th, 2020
People constantly post on Apple’s developer forums complaining that when they try to install Xcode, an alert opens saying they don’t have enough disk space to install it. These people always say they have enough space because they have more free space on their disk than the Xcode download. Usually the person asking the question has 15–20 GB of free space on their startup disk.
The Xcode file that you download is a compressed file. You need enough disk space to store both the compressed file you downloaded and the expanded file. Suppose your Xcode download is 8 GB. The expanded file is going to be bigger than that. Xcode 11.4.1 takes up 17.39 GB on my Mac. At this point you need 25.39 GB of free space. Add in some temporary storage space for swapping files, and you need a minimum of 30 GB of disk space to install Xcode.
30 GB of disk space is just an example. That may not be enough free space, especially for newer Xcode versions. Xcode releases keep getting larger over time so the amount of free disk space you need will increase as well.
If an alert opens saying you don’t have enough space to install Xcode, you don’t. Have enough free disk space that is at least 5 times the size of the compressed Xcode file you are going to download from Apple. I know that can be hard to do, especially if you are using a laptop with a 128 GB SSD, but you have to free up the space.
The app DevCleaner for Xcode can free up gigabytes of disk space by removing caches and other old files that accumulate over time.