'Xcode on Mac App Store can't install, show disk space not enough

I'm using macOS to install Xcode 10.1.

I have 18.43 GB free disk space on my Mac, but when I click the install button next to Xcode in the App Store, it always shows the "Not enough storage disk space, you can't install the product" alert message.

How do I fix this problem in macOS Mojave(10.14.1)?

enter image description here

enter image description here



Solution 1:[1]

What you can also do is manually download Xcode and install it. (Without using the app store update) Therefor do the following steps:

  1. go to https://developer.apple.com/download/more/
  2. search for Xcode (or latest version e.g Xcode 10.2) and manually download and install it.

See also this post here: https://discussions.apple.com/thread/8622103?answerId=250008933022#250008933022

Solution 2:[2]

Check the "purgeable" space of your APFS disk with Disk Utilities.. It seems Finder count this space in free space, but not App Store..

But you can trick macOS to clean up APFS by creating a huge garbage file, then deleting it.

To create the file I used the command:

dd if=/dev/zero of=/Users/<username>/hugefile bs=100m

letting dd run for about 30 seconds, then killing it with ctrl+c, and deleting the file:

rm ~/hugefile

Then App Store happily installed update..

Solution 3:[3]

  1. Open finder: in menu above go to -> Go to folder:

    ~/Library/Developer/Xcode/

  2. Delete old simulator files on:

    ~/Library/Developer/Xcode/iOS DeviceSupport/

  3. Delete all files derived data on:

    ~/Library/Developer/Xcode/DerivedData

An easy way to accomplish these is by using DevCleaner for Xcode: https://apps.apple.com/us/app/devcleaner/id1388020431?mt=12

Solution 4:[4]

I had 52 GB available (39 GB purgeable), but the stupid Mac App Store in macOS 10.14.4 still said it had not enough free space to complete my purchase of Xcode 10.2, even after a restart. Solution:

  • Quit the Mac App Store.
  • Delete directory ~/Library/Caches/storedownloadd
  • Relaunch Mac App Store.

My Xcode "purchase" then worked on the first try.

For the curious: At the time I deleted that directory, it did not contain any app downloads. It only contained a tiny (85 KB) SQLite database (.db, -shm and -wal files), which in turn contained four SQLite tables, three of which had zero rows and one of which had only one row and one column containing the schema version number! So this is apparently some weird bug in Mac App Store.

Solution 5:[5]

Trying to update to xcode 11.3.1 today, was in the problem like this. However, I can confirm that the download starts right after free space reaches 24GB as per some of the comments above.

I did the following:
- remove ~/Library/Caches/storedownloadd
- remove ~/Library/Developer/Xcode/iOS DeviceSupport/
- remove some files inside ~/Library/Developer/Xcode/DerivedData
- remove other unused files

Solution 6:[6]

the problem with time machine! please remove old snapshoots

sudo tmutil listlocalsnapshots /
com.apple.TimeMachine.2019-09-25-135035
com.apple.TimeMachine.2019-09-28-232824
com.apple.TimeMachine.2019-09-29-012547
com.apple.TimeMachine.2019-09-29-022054
com.apple.TimeMachine.2019-09-29-031621
com.apple.TimeMachine.2019-09-29-052318
com.apple.TimeMachine.2019-09-29-070831
com.apple.TimeMachine.2019-09-29-092229
com.apple.TimeMachine.2019-09-29-101756
com.apple.TimeMachine.2019-09-29-114952

tmutil deletelocalsnapshots 2019-09-25-135035
tmutil deletelocalsnapshots 2019-09-28-232824

etc

Solution 7:[7]

The same here for Xcode 11.2. It is mandatory to have at least 28GB free.

removing different directories such us, caches, .eclipse, .julia directories to free up.

UPDATE: 24GB with lastest version: 11.2.1

Solution 8:[8]

  1. Quit App Store
  2. Delete both storedownloadd and storeassetd from ~/Library/Caches/
  3. Relaunch App Store
  4. Try again

The above steps resolved the issue for me.

MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)

macOS Mojave Version 10.14.6 (18G87)

Solution 9:[9]

this command works perfectly, it removed AFPS snapshots

tmutil thinlocalsnapshots / 21474836480 4

Got the reference from this forum

https://forums.developer.apple.com/thread/110533

Solution 10:[10]

Adding to @Biba's answer of directly downloading the version you want of Xcode from More Downloads for Apple Developers by signing in with your Apple ID.

First, delete Xcode application and then manually delete as much data as you can of Xcode located at ~/Developers. But even after that, you might not be able to save enough space for downloading and unpacking.

The file from Apple's site is a .xip file that needs to be unpacked and to get a Xcode.app file. Together they take well over 40 GB of space. And I could not clear that much space so I had to use an external drive to unpack the downloaded file. This process can take well over 1.5 hours to copy and unpack the file.

code unpacked file size

Once you get the Xcode.app file, copy it over to Applications using finder. It will first say, Preparing to copy to "Applications". After about 10 to 15 mins it will change to, Copying "Xcode" to "Applications". This should take another 30 - 40 mins. While you copy make sure you have a couple of extra GBs free. On the first load, it will open a popup, Verifying "Xcode.app". The verification takes 10-15 mins. Then it will ask for your Mac password to install additional components.

All the best. This is a really irritating update process.

Solution 11:[11]

I solved it by upgrading MacOS as I'd have an old version installed. After a restart it magically had space :D (the same by the way)

Solution 12:[12]

For my case: I already have xcode 10.1 in my MBP.

  1. Delete directory ~/Library/Caches/storedownloadd and storeassetd directory in the same dir.
  2. Reopen the app store and go for the upgrade page.
  3. Download the xcode 10.2 from https://developer.apple.com/download/more/
  4. Somehow the app store will automatically install the xcode 10.2 right after download is finished.

Done.

Solution 13:[13]

Mine is a weird solution. I did not have storedownloadd folder previous solutions talked about and manually downloading was not a real solution(what about future updates)

I manually created storedownloadd In the following directory re-started App Store, although loader took forever(restarted MacBook hoping for a change) it started downloading :)

~/Library/Caches/storedownloadd

Solution 14:[14]

Try installing any other small app in the App Store and then install Xcode. It worked for me. In my case, I had 40 GB empty space but could not install Xcode due to the same error. Deleting ~/Library/Caches/storedownloadd did not work for me either.

Solution 15:[15]

TL;DR: Deleting XCode (~7GB) and then the folder Users/[insert your mac username here]/Library/Developer (~90GB) freed around 100GB. I then installed XCode off of the App Store and it worked like a charm.

The answers above, such as rm hugefile did not work for me because I guess I had a legit memory issue. Downloading the XCode file and manually installing did not work because I still got the space/memory error.

I had about 10GB of free space according to Disk Utility.

Deleting XCode (I had it prior but had to update it) and other applications brought me to 17-20GB.

Still didn't work.

I had to go into the Users/[insert your mac username here]/Library/Developer and I deleted that directory, which I guess somehow saved XCode crap even though I deleted the application.

That brought me to a stunning 120GB.

120GB.

That is half of the memory on my hard drive.

?!

No idea how that works.

I then installed XCode directly off of the App Store and it works like a charm.

I guess be careful because I am not sure what is in that directory.. It did not seem important and all seemed XCode-related. It looked like simulators for XCode and other XCode related stuff. I am not sure. I use XCode A LOT so maybe error logs or usage logs built up. Even then - that's just text. So I am not sure. If I run into any weird issues that might result, I will post it here, but so far nothing.

Also, I highly recommend OmniDiskSweeper, which is a free program and is how I figured this out (among other memory-related issues in the past)

Solution 16:[16]

For Xcode 12 you need to have more than 32GB free space.

Delete the old Xcode application first.

Install OmniDiskSweeper which will show the total space used by the folders, which will be useful to detect the folders which occupy lot of space.

Go to Users -> your_user_name -> Library -> Developer (these are old xcode contents), delete all the contents here, since we are installing new xcode, the old contents are not necessary.

If you have Android Studio and willing to delete it, and install later, then delete the Android Studio application and on OmniDiskSweeper, go to Users -> your_user_name -> Library -> Android (these are old android studio contents), delete all the contents here.

Which will give you a lot disk space.

Solution 17:[17]

I was literally at the same number today. I was able to download once I got my free space just over 20GB.

The issue for me was my Archives on some larger projects were taking up too much space. I will have to do a better purge, but just removing the failed uploads was enough to lower the system space and download the latest Xcode.

Here is a great link that explains this in further detail, as well as Simulator Cleanup and Derived Data.

Free Up Mac Storage

Sadly when I bought my Mac, I wish someone had told me to get over 250GB of space. All the recommendations said the 125GB was fine for running Xcode. Alright for learning iOS, but I guess they failed to evaluate large long term development.

Solution 18:[18]

I ran into same issue trying to install XCode 11.beta after installing macOS Catalina. What i did:

  1. delete ~/Library/Caches/storedownloadd
  2. delete ~/Library/Caches/com.apple.appstore
  3. uninstall previous version of XCode (10.3) -> wait till all the files are deleted, can check in Disk Utility
  4. fresh restart -> without opening the apps before restart
  5. install new XCode version with Archive Utility.

Solution 19:[19]

Same thing here, tried most of the above. 107 gigs of space free, but not enough to install.

So I downloaded Xcode from Apple directly (https://developer.apple.com/download/more/) and copied the .xip file to an external driven with lots of space.

I was then able to do this:

cd /Applications
xip -x "/Volumes/Blue 2T/Xcode_11.3.xip"

Don't forget to get rid of the xip file when you're done.

Solution 20:[20]

Instruction for Install Xcode 13

Make sure

  1. You must Download Xcode from Apple directly (https://developer.apple.com/download/more/)
  2. Please double check MacOS compatible version with Xcode to be download. You must have macOS Big Sur Version 11.3 or later
  3. Disk space at least 40 GB free.

Tested by installed Successfully ?

Solution 21:[21]

The App Store app does not account for the purgeable space. I have filed a feedback on this issue some weeks ago to the Apple Feedback Program: it seems fixed since macOS Catalina, as now it works without workaround.

For previous MacOS see this answer

Solution 22:[22]

It's not the prettiest solution, but I simply open Applications folder in Finder and drag Xcode to the bin, and delete it! :D

Then open App Store, find Xcode and install it again.

This still allows future updates from App Store. I have done this already multiple times over the last 6 years, especially for major version updates, as this always ended up being the simplest solution for me when I encounter such issues. This way you are not required to tamper with Developer folder data, unless you want to do some cleanup.

p.s. I found no harmful effects of this approach on my projects.

Solution 23:[23]

For me, I had an extra folder in my Macintosh HD/Volumes/ folder, Im not sure how it was created, but it was some sort of copy of my external harddrive. After deleting it, I was able to download xcode

Hope this helps

Solution 24:[24]

in my MacBook had 31 GB available (14 GB purgeable), macOS 10.14.5 still said it had not enough free space to complete my purchase of Xcode 10.2, just deleted directory ~/Library/Caches/storedownloadd, started downloading.

Solution 25:[25]

Always late to the party, but anyway... i noticed a correlation with time machine backups, since i had a failed backup some time earlier and didn't connect my time machine hdd since.

After starting the Time Machine Backup and properly cancelling it soon after, i was able to install the update. Try it :)

Solution 26:[26]

I also have this problem with a whopping 240GB available.

enter image description here

It seems that purging simply does not happen. I created a really big file, but it died because of no disk space:

paul-> dd if=/dev/zero of=~/zeroes bs=100M
dd: error writing '/Users/paul/zeroes': No space left on device
151+0 records in
150+0 records out
15728640000 bytes (16 GB, 15 GiB) copied, 33.0689 s, 476 MB/s
[~/Library/Caches ]
paul-> ls -lh ~/zeroes 
-rw-r--r-- 1 paul staff 15G Nov 17 09:27 /Users/paul/zeroes

It certainly should not have stopped at 15 GB

paul-> df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/disk1s1    466G  268G  197G  58% /
/dev/disk1s4    466G  1.1G  197G   1% /private/var/vm

Oddly enough, after removing the big file, I was able to download Xcode from the App Store.

Solution 27:[27]

Additionally, Check the previous Xcode consumed storage through OmniDiskSweeper and delete unnecessary data and simulators that will free up too much size.

enter image description here

Solution 28:[28]

After trying almost everything that i found can filter what exactly worked for me. Catalina 10.15.7 Xcode12.

  1. Go to your home folder in finder and make sure to enable hidden files shift + command + . //yes its a **dot** key on keyboard
  2. type dd if=/dev/zero of=/Users/<YOUR_USERNAME>/file bs=15m hit enter
  3. monitor the size growth of file named file in finder
  4. when it reaches something around 4-5GB kill the terminal with cntrl+c
  5. open disk utility and check purge size start copying and pasting that huge file named file that you just made and monitor the purge size. When it will get 3-4GB its now time to delete all that huge files and empty trash.
  6. restart
  7. open terminal go to /library/developer/
  8. delete all folder and files inside coreSimulator (this was the only resort for me)
  9. go to /library/developer/xcode/deriveddata and delete all folders and files inside
  10. empty trash

Go to App Store and update the Xcode.

Solution 29:[29]

Just run below two commands in your terminal:

cd ~/Library/Developer

rm -rf Xcode

Solution 30:[30]

Proven Result ?

How to check space in current user?

Apple icon (Top left) -> About this Mac -> Storage -> 39 GB or more.

You must have 39 GB or more space to install Xcode 13.3.1 version.

Recommended to Buy minimum Mac 256GB space to work with Xcode / Flutter.