"Not enough free space" when trying to install XCode even though there's ~7x more free space than required

The title says it all...

I am trying to install XCode, constantly getting that message, no matter what I try. Currently I have 41+ GB free space, XCode requires 6.1 according to App Store.


Please suggest how to solve this issue.


Thanks a lot in advance!

I literally can't download XCode because even deleting every single App on my Mac wouldn't give me enough space. Even deleting the Library folder wouldn't do it. I need to update XCode to do my job, and I tried deleting it so I could download the new version. Now I don't have 11.6, and can't download the new version either. I'm left without XCode at all. System files take up too much space. I have a 128 GB OS drive, where XCode wants to install, and I can't get enough free space.
If they let us install the newest XCode on another drive, maybe I wouldn't have this problem.

....Or maybe if it didn't require a ridiculous amount of space to install compared to how much space it actually uses, I wouldn't have this problem either. XCode is the most painful program I've ever had to use.
It took me a week, barking up the wrong three a lot, but I did it, an here is how:

My premesis:
  • A MacBook Pro 2017 with less than 10G space left

  • An Ubuntu 20.20 with plenty of space

  • An external 1TB SSD formatted with HFS+ and named "SSD"

Start with your Mac.
At first download Xcode from:
Code Block
https://developer.apple.com/download/more/?q=xcode

directly to your external disk, changing the download location in the Safari preferences. I have chosen v12.0.1.
Go to terminal an change directory to the mount point of your external drive.
On your Mac now unpack the .xip file using:

Code Block
xar -xf Xcode_12.0.1 /Volumes/SSD/


This is going to give you a folder named "Xcode_12.0.1" with two files inside: Metadata and Content.

Now switch to Ubuntu.
Download the files from this repository:
Code Block
https://github.com/NiklasRosenstein/pbzx/blob/master/pbzx.c

To compile it, I needed to download and install some old libraries from Ubuntu 14.10 on my Ubuntu 20.20.
I can provide more Information about this if needed, but mainly it is about the following libraries and packages:

Code Block
libxar-1.6.1-alt3.x86_64
libxar-dev_0.7r1785-5ubuntu2_amd64
xar-1.6.1
libpng12-0_1.2.50-2+deb8u3_amd64
libwxgtk2.8-0_2.8.12.1+dfsg-2ubuntu2_amd64
libwxbase2.8-0_2.8.12.1+dfsg-2ubuntu2_amd64

I also had to look for the xar.h I found somewhere I don't remember.

To make it easier I forked and uploaded the resources and a compiled version to:
Code Block
https://github.com/FolkertsHeiko/pbzx

Sure you have to trust me, but you can. I promise ;-).
If you want to do it yourself, here is the gcc command line, but do not expect it to work out of the box:

Code Block
gcc pbzx.c /usr/lib/libxar.so -lxar -llzma -o pbzx


To mount the external volume you sure going to need the hfsprogs package:
Code Block
sudo apt-get install hfsprogs


Next, mount or remount the HFS+ drive:

Code Block
sudo mount -t hfsplus -o force,rw /dev/sdXY /media/mntpoint


or

Code Block
sudo mount -t hfsplus -o remount,force,rw /mount/point


Now decompress the Content file with the self-compiled pbzx binary, both mentioned above, and unpack it with cpio, which already was installed on my Ubuntu System:

Code Block
pbzx -n /media/heiko/SSD/Xcode_12.0.1/Content | cpio -i


This will give you another folder in your current working directory, named Xcode.app

Go back to your Mac and link the Xcode-Application:

Code Block
cd /Applications
sudo ln -s /Volumes/SSD/Xcode.app/ .


Now run it with Finder, which is going to take a while for the first start.
After that, Xcode should run from your external drive.

I hope this is helpful.

Happy coding,
Heiko.

Edit: Typos

tl;dr: You are only going to need round about 45G on the external SSD. My solution is to unpack the .xip file containing Xcode manually there and run it.
same thing here. I've had 41Gb free space and anyway been forced to delete XCode & reboot before XCode upgrade agreed to download. it is maddening
Guys, just throw this shit and buy Samsung laptop with hackintosh.
BartoszMaciejewicz has the right answer...

Hey, I found a working solution

After update macOS to the 10.15.6 I noticed that Xcode throws info that is not enough space on disk to update app, so I tried to run old Xcode and I noticed a popup about missing requirements, after click "install" the problem about updating Xcode in AppStore gone.

There was no needed steps to uninstall Xcode so I'm happy of that :)

I hope that this will help you too

Posted 1 month ago by BartoszMaciejewicz 
My XCode 12.0.1 was not updated to 12.1 (there was a notification that there was not enough free space) - 35GB was available on the disk.

In the end, I solved this problem by getting 45GB of free space and Xcode began to update.

I think this is not a bug. If the App Store indicates that the size is, for example, 11.3GB, then this is only the package size. In reality, after installing Xcode, it takes a lot more. For example, I have 16.2GB of the application itself + 35.3GB of additional resources in the Developer folder (simulators, archives, etc.). 51.5GB! And updating and downloading an application is only possible if there is space to install the application, not to download it.
Apple stop wasting our time, fix this it is just outright a disappointment.
Stop messing our development time and streamline this process.

Code Block
cd ~/Library/Developer
rm -rf Xcode

This seems to be the quickest way around this for now.
thanks @ajax8732  & @bob1993

This is such a shame Apple.
Around 50 gb of disk space works
Xcode 12 takes 28 GB installed + a place to hold the compressed app image of about 14Gb, that is 42 Gb. The compressed image can be deleted AFTER the install completes.

The error message is legitimate.
I never post to forums, but this one has my blood boiling!
Here's my fix, then I'll explain how I got there to save time for those that aren't bothered with the story.

I deleted 10's of Gb from the developer folders:
/(myuser)/library/developer/xcode/ios devicesupport/(device versions back to iOS7)
/(myuser)/library/developer/coresimulator/devices/(device GUID)

Viola!

So, I lost a day to this. 36Gb was not enough space, so I deleted some applications, but no joy.
Storage Management recommended that I delete large files, which it said were all in OneDrive. That's when I learned that you can't easily remove OneDrive (thanks Microsoft for your help here).

After downloading 30Gb of files in OneDrive, so that I could delete them locally, the free memory didn't increase. I should have known because cloud storage doesn't take up local space. This is a failing between Storage Manager and OneDrive, where one thinks the other is using HD space.

After losing a day, I paid for CleanMyMac, which pointed me to the Xcode folders above.
So let's get this straight: I can't install Xcode because Xcode has filled my computer with libraries for iOS 7-10 compatibility.

Apple, please do something about this. You charge enough for your development program that it shouldn't be this painful.
im actually thinking to leave apple after all the years i have invested in xcode-objc, swift.
it's just, i feel like, they are not worth all the pain anymore...
These steps finally works for me by using Terminal:

Remove Xcode (Removing /Application folder requires using sudo for root access):
Code Block
sudo -s
rm -rf ~/Library/Developer/Xcode
rm -fr /Application/Xcode.app


Download Xcode from Apple:
Code Block
https://developer.apple.com/download/more/?q=xcode
  • Download to a Removable Drive

  • or Move the file from Download Folder to the Removable Drive

  • I use a 32GB USB Flash Drive formatted with Mac OS Extended using Disk Utility

Extract and Install:
Code Block
sudo -s
cd /Application
xip --expand /Volumes/<USB_DRIVE>/Xcode_<version>.xip


i just stop being Apple app developer.
i don't need this ******* problem anymore.
40GB not enough?
what wrong with Apple.
is they meet their end?
i will change my Macbook to laptop next week.
Same here, I seem to have that problem * every single time * Xcode gets updated - right now I have 34 GB available on my HD, and Appstore says that the Xcode 12.3 update needs 11.6 GB - yet when I tried to install, I get "Not enough disk space". I reckon there is some decompression of downloaded files going on, but 34+ GB available space not enough disk space is a ludicrous management of resources on Apple's part. I guess my only option is to uninstall Xcode first and then re-install the latest version from scratch.

Apple, you guys are the experts - this is the best you can come up with..??? What a shame.
Here's what helps:
  • In the Apple Manu, go to About this Mac > Storage > Manage > Developer (nice little Easter egg hunt, well done Apple!)

  • Look for older iOS variation you don't need, those can easily take up a good number of GBs

  • There are also big size options "Xcode Caches" and "Project Build Data and Indexes", though I'm not sure how much trouble might be caused by deleting those

  • Lastly, uninstall Xcode before installing a newer version

  • There also is a free ("suggested tip-ware") app named DevCleaner which essentially appears to look for the same files as described above

Some more proactivity on Apple's part on this would certainly be useful though. To just leave a user with a "Not enough disk space" error message upon trying to update Xcode when there are dozens of available GBs on the drive is not exactly helpful.
I can verify that, having 50GB free storage on machine will resolve this issue. I was having 18GB previously, though the xcode12.3 xip size only 11.63 yet I can't extract.

Some files you may consider to remove to get get storages
  1. com.apple.dt.XCode (~/Library/Caches) - about 2gb

  2. iOS DeviceSupport (/Library/Developer/Xcode/iOS DeviceSupport) - I have like 32 GB here

  3. DerivedData (/Library/Developer/Xcode/DerivedData)

basically, Apple wants me to free up 50GB of storage from my 128GB MacBook pro.
well done Apple!!!!

This is a shameful apple.. at least you should reply to this.


I’ve gotten that issue a lot as well. For me, it worked after I restarted my laptop.

Hope this helps!
Managed to get it to install after deleting the various folders in Cache and elsewhere mentioned in this thread.

This is typical of Apple really. They make nice hardware, but when it comes to their software it's pretty flakey, often not very intuitive, and while perhaps some people push the line that Apple software "just works" that's certainly not my experience. The frequent changes to App Store Connect documentation, web interface, certificate and signing rules, etc etc., demonstrate a blatant lack of respect for the Apple developer community. Having to clear 50GB just to update a package that it already installed is, simply, poor design and poor implementation, but more fundamentally it just shows the Apple philosophy: "You want to develop for our platform? You need to work or beg for the privilege"
This has been, without a doubt, the most frustrating experience I've had as a developer in my 10+ years of software development. Why, in God's holy name, do I need 40GB+ just to update a framework that I ALREADY have installed in my system? Apple really expects you to have a machine SOLELY for the privalge of developing apps on their platform. This is beyond explanation, and by all accounts, intentional. I, for one, will think twice about developing for Apple in the future after this horrid experience.
It worked for me after restarting my laptop as w/ @CodeSwiftUI
Shame on Apple! I have 41 GB free space but I can not update latest Xcode which has just 12 GB. How much place it needs to unzip? My 4 year old MAC with 120GB disk is not usable I can trash it because I have there just MAC OS + Xcode and it says that 40 GB is not enough for Xcode update. Terrible! Also it always downloads Xcode from the start! Dear Apple, why I have to download several times 12GB when you show alert about not enough space to install (but it is already downloaded because it has only 12Gb and free space is 40 GB, why you delete it???). I have to download again and again after unsuccessful Update button click.
"Not enough free space" when trying to install XCode even though there's ~7x more free space than required
 
 
Q