67

Xcode is showing in the Mac App Store, ready to be updated. Clicking update results in an error:

Xcode failed to download. Use the Purchases page to try again.

Steps taken that didn't help:

  • Rebooting
  • Removed ~/Library/Cookies/com.apple.appstore.plist
  • Searched and removed MAS-related files:

    sudo find /var/folders/ -ipath '*com.apple.appstore*' -print | xargs sudo fgrep -i xcode
    sudo find /var/folders/ -ipath '*com.apple.appstore*' -delete
    

How can I successfully update Xcode?

1

23 Answers 23

59

Deleting the temporary folders as recommended didn't help. In the end I got it working again by enabling the Debug menu for the App Store app and resetting the application; it is now finally downloading the update as it should.

Steps:

  1. Open Terminal.

  2. Run the following command:

    defaults write com.apple.appstore ShowDebugMenu -bool true
    
  3. Relaunch the App Store.

  4. Choose the menu item DebugReset Application.

Based on steps from: https://discussions.apple.com/thread/4398074?start=0&tstart=0

It is possible that signing out (StoreSign Out) might have solved the issue too (part of the application reset process is to sign you out) but this was not tested.

5
  • 2
    After resetting, I also had to quit the AppStore application.
    – Epu
    Nov 4, 2013 at 23:52
  • 2
    Just signing out does not help. I tried signing out, closing the App Store application, re-opening and signing back in, but still faced the same problem. Following your instructions to Reset Application did solve the problems perfectly though! Apr 20, 2014 at 5:10
  • This worked for me when things got hung up downloading Xcode 6.
    – James
    Sep 19, 2014 at 20:31
  • 4
    As of MacOS 10.12.1 this no longer seems to work Oct 28, 2016 at 21:05
  • This made my app store show the message "Cannot Connect to App Store" on Mojave Oct 28, 2019 at 17:50
25

You could use the direct link to download xcode from the Developer Center: https://developer.apple.com/downloads/index.action

3
  • 2
    the best (since quickest) answer for me. Dont understand the downvotes
    – brainray
    Nov 10, 2014 at 11:55
  • 2
    worked, and many other approaches on this page didn't. Jun 1, 2015 at 18:09
  • 2
    The downside to this approach is that you won't get automatic updates. Oct 23, 2015 at 21:34
17

This is a dumb one, but I found that the reason I was receiving this message was that my hard drive was full. So I cleared up some space and it installed just fine.

Facepalm.


Truth be told, the App Store should have better messaging around this. It's not an unknown error, we totally know what it is.

Be forthright, App Store, come on.

6
  • 1
    i experience the same thing Oct 15, 2014 at 15:12
  • How much space did you need? Dec 14, 2014 at 0:27
  • 3
    I had about 8 GB and I got the error. Made space for about 12 GB, got it installed. It still showed the error in the App Store though, after restarting it recognized that Xcode got updated, all good... Bad Error-Messaging... -.- Feb 2, 2015 at 14:45
  • If you clear up some space for XCode, be sure to empty your trash. Feb 27, 2015 at 15:38
  • Oh wow. Same for me, had about 7gb left. Apr 27, 2015 at 20:10
8

The steps to get things to work are quite simple.

  1. Keep the AppStore App open.
  2. Open terminal and type

    cd /private/var/folders/
    
  3. Once there, search for com.apple.appstore

    find . | grep com.apple.appstore
    
  4. You will find folder structure like this ./40/lhn22jn901zdw2bpf82hkggw0000gn/C/com.apple.appstore

  5. Once inside the folder, open it in finder

    open .
    
  6. You should see a folder and a manifest.plist. Open up the plist to see the file. Towards the end you will see lines which says that key is title, and string is XCode.

  7. Now you have the folder which is making your life miserable.
  8. While keeping AppStore open, remove this folder

    rm -rf *
    
  9. Now, go back to AppStore and click on Download again.

5
  • 1
    My vote for the best answer.
    – Kunal Vyas
    Apr 21, 2013 at 15:48
  • Did not work for me :(
    – dst
    Oct 6, 2013 at 9:49
  • Did not work for me either :(
    – Joel
    Oct 2, 2014 at 0:56
  • 1
    You deserve a million up vote. Although developers would understand more than regular users, but this did the trick :)
    – Nour Helmi
    Oct 8, 2014 at 1:27
  • 1
    Only solution that solved my problem :-) Thank you!
    – Qorbani
    Oct 6, 2015 at 16:11
3

Here's what worked for me:

  • Good network connection
  • Enough free space (if you need a few GiB, just sudo rm -f /var/vm/sleepimage, osx will recreate it as needed)
  • Check 3rd-party app firewall for interfering "deny" rules
  • Close App Store
  • rm -rf /private/var/folders/pd/*/C/com.apple.appstore
  • Reboot
  • Run updates (works!)

To see what's going on while updates are installing:

  1. Set debug menu defaults write com.apple.appstore ShowDebugMenu -bool true
  2. In App Store > Debug, Debugging Level 4, Log XML, Log Headers & Javascript Logging
  3. In Terminal: tail -f /var/log/installer.log /var/log/commerce.log
  4. Run updates
  5. Be sure to disable debugging options before disabling the Debug menu
1
2

Same thing happened to me but I got it installed today. Two possible reasons,

  1. Apple have finally fixed it
  2. App update has some issue with the mac going to idle mode. Because today I downloaded it while I'm working and my failed attempts were when I left the mac idle while it is downloading
2

I had a similar issue but with a different application. It had downloaded about 70% of the way there on Mountain Lion before the OS went to sleep. This lead to the "Failed to download/Use the Purchases page" error. After some web searching I found this thread that answered my problem:

https://discussions.apple.com/thread/4362474?start=0&tstart=0

The solution for me was to open activity monitor, double-click the AppStore process, and select "open files and ports". Somewhere in this list is a folder starting with "/private/var/folders/". For me it was:

/private/var/folders/hw/...

I quit the AppStore, deleted this folder, restarted AppStore. After clicking "install" again the download started fine.

2

I wanted to add my experience to this thread to help searchers. This has been bugging me for months and I was determined to sit down and fix it. The fact this Q refers to xcode is completely immaterial, I was seeing this issue across several apps with no commonality. I tried numerous searched fixes, including

  • wiping all caches, cookies amd such like
  • relogged into my account, signed out signed in etc
  • rebooted, reset app store, manually deleted caches and such like
  • screwed about with DNS, networking as mentioned in some quarters (red herring IMO)
  • enabling the debug menu for app store ( defaults write com.apple.appstore ShowDebugMenu -bool true ) - this is what ultimately lead me to my solution

My symptoms were: various apps were uninstalled (moved to trash can etc) OR were updated over time. Then app store would show same apps and "Update" button. You click it, and the "an error occurred" message would appear, then the "Please use Purchase page..." Using purchases page buttons resulted in the same error. I tried dozens of combinations of solutions and googled it to death.

The solution in the end was quite odd. With the debug menu enabled, I switch on logging level 2 (at random), tried to reinstall a smallish app I bought a while back. Then skimmed through /var/log/install.log I saw an extract like this (some IDs deliberately obfuscated due to paranoia)

Dec 30 19:00:36 macbookpro installd[23755]: PackageKit: ----- Begin install -----
Dec 30 19:00:36 macbookpro installd[23755]: PackageKit: request=PKInstallRequest
<1 packages, destination=/Volumes/Iomega_HDD>
Dec 30 19:00:36 macbookpro installd[23755]: PackageKit: packages=(
    "PKLeopardPackage <file://localhost/var/folders/hb/6_bxxxxxxxxxxxxxxxxxxxx/C/com.apple.appstore/xxxxx3/xxxxxxxxxxxx33.pkg#com.neatberry.PhotoStyler.pkg>"
)
Dec 30 19:00:36 macbookpro installd[23755]: PackageKit: Install Failed: Error Domain=NSCocoaErrorDomain Code=640 "You can’t save the file “Iomega_HDD” because the volume “Iomega_HDD” is out of space." UserInfo=0xxxxxxxxxx     {NSFilePath=/Volumes/Iomega_HDD} {
        NSFilePath = "/Volumes/Iomega_HDD";
    }

And there it was - a weird reference to an external drive during an install.

My "Iomega_HDD" is a FW drive always attached. I was using it for SuperDuper root disk mirroring. However my files had grown bigger than the drive, so it had been sat mounted and idle for probably 8-12 weeks (do not worry: timemachine was working to a NAS :-)

Being a mirror, and mounted, I can only assume that somehow app store monitored, or maintained some sort of linkage to the files on there, eg so previously deleted / purged apps on my root drive were present on the mirror.

Anyway, long story short, I unmounted the mirrored external drive, restarted App Store, used the debug menu item to "reset" and amazingly, all the apps magically corrected themselves to "Install" rather than "Update" and the Install/Update statuses also corrected themselves. And more importantly, all the buttons worked and no more error messages!!

I know how bizarre this sounds but the proof is in the logs. App Store was taking into consideration a mirrored (idle) drive that had legacy copies of the apps on.

1

Similar story here.

An external drive I had attached for a Carbon Copy Cloner backup had also been left attached for some time. I noticed that the activity light was flickering so I ejected it. Finder complained that an app was accessing it, but why should it, only CCC accesses this drive. Assuming it was spotlight acting daft, I force-ejected it.

Shortly after, the app store app showed errors in updates it was carrying out, including an Xcode update that I was sure it had already done a couple of days ago.

Simply unmounting it and restarting App Store didn't help. Deleting the caches for App Store didn't help.

I followed the tips here (enabling Debug, performing a reset) I then rebooted and opened App Store again. I had to sign-in and only one app (out of the four that had been updating) was shown as update available. This updated without error. I therefore assume the other three had been apps that the App Store had been trying to update on the mirrored external drive.

There is clearly a bug here that the App Store is going looking on external drives rather than sticking to the apps it installed in the internal drive.

1

In my particular case, the only way to fix it was to turn off my company's VPN.

Details: I was trying to install Xcode 6.3.1 on OS X Yosemite 10.10.3. All of the previous solutions didn't work, although the suggestion to debug the installation process through App Store and to tail the log files were crucial to find the root cause.

Steps to find the root cause

  1. Activate debug menu on a Terminal window:

    defaults write com.apple.appstore ShowDebugMenu -bool true
    
  2. Now on App Store, go to Debug menu and check, "Log XML", "Log Headers", "Debug Logging Level 2"* and "Javascript Logging".

    * you should try other levels if 2 is not enough

  3. Back to Terminal, run tail -f /var/log/install.log /var/log/commerce.log

  4. Start the installation on App Store and follow the logs on Terminal

Root cause of particular issue

I found these messages on the log, pointing out to a network failure and request timeout:

==> /var/log/commerce.log <==
Apr 23 10:10:58 macbookname storedownloadd[1234]: Logged "Request"
Apr 23 10:11:59 macbookname storedownloadd[1234]: ISStoreURLOperation: Waiting a bit before retry #2 after a network failure
Apr 23 10:12:00 macbookname storeaccountd[2345]: ADI: Account is not provisioned, omitting OTP and MD
Apr 23 10:12:00 macbookname storedownloadd[1234]: -[ISURLOperation _logRequest:]: Sending request for http://a71.phobos.apple.com/us/<obfuscated-value>.pkg
Apr 23 10:12:00 macbookname storedownloadd[1234]: Logged "Request"
Apr 23 10:13:01 macbookname storedownloadd[1234]: ISStoreURLOperation: Chose not to retry after error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=<obfuscated-value> {NSLocalizedDescription=The request timed out.}
Apr 23 10:13:01 macbookname storedownloadd[1234]: AssetDownloadOperation: Asset download cancelled/failed.  Will do retry #1? 0
Apr 23 10:13:01 macbookname storedownloadd[1234]: DownloadOperation: Download failed with error: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=<obfuscated-value> {NSLocalizedDescription=The request timed out.}
Apr 23 10:13:01 macbookname storeassetd[3456]: SoftwareMap: No app was found with bundle ID com.apple.dt.Xcode to upgrade to 6.3
Apr 23 10:33:14 macbookname storedownloadd[1234]: sending status (Xcode): 0.000000% (0.000000)

Once I turned off the VPN, I was able to download it successfully, tracking the Received Bytes of the storedownload process on Activity Monitor > Network tab:

0

I had the same issue. I basically used Aitch's solution which is to unmount any cloned hard drives.

To discover the error and solution, I followed Aitch's steps.

1) Enabled debug menu in App Store using Terminal command ( defaults write com.apple.appstore ShowDebugMenu -bool true )

2) Quit and relaunch App Store app.

3) Enabled logging level 2 in the App Store Debug menu, and tried to install an app that was resulting in the error.

4) Skimmed through "/var/log/install.log"

My logs showed: "You can’t save the file “MyHDClone” because the volume “MyHDClone” is out of space."

So, it appears that the App Store was reading information from an external drive that I use to keep a bootable clone of my internal drive.

I unmounted the external clone, Quit and restarted the App store and whola! All my apps were back in correct status. Several of the "updates" that were previously showing were now gone because I had updated them on my internal drive, but had not updated my clone, which is where the App Store was reading the status from.

0

The solution for me was quite simple, if a bit odd. I quit App Store, relaunched it, then 'quit process' from Activity Monitor. After that I relaunched App Store again and the app downloaded fine.

0

I tried many suggestions related to this error. Saw that the city name on my credit card info was wrong. Updated by Credit Card info in the App Store, validated the account on my new Retina and then was able to update iPhoto, iMove and Garageband. Validate your credit card on the new machine. Werken

0

The problem was with mac (10.8.3) in idle mode, i was working on VMWare.I started downloading xcode (4.6.3) on VM and roaming around for break leaving my system.I came back and found xcode failed to downloading with kinda purchase page...message. I signed out from developer apple, then quit app-store.Again launch app-store and login. Now installation successful.

0

Me also face this issue. I asked to My System Admin. They Remove firewall restrictions. then its downloaded fine.

It may help for some one.

0

One of the answer posted that mentioned the lack of disk space was my problem (but I can't comment on it because my reputation is still too low).

I had 7Gb of hard drive free space and was getting that error. Tried the main solution and all the other ones posted and none of them worked.

Then I tried freeing up hard drive by uninstalling a bunch of apps I no longer need and got about 45Gb free, then tried installing again and this time it worked without a hitch.

So yeah, bad error message from the App Store -- and it should verify you have enough space for the installation before it tries to download. I think currently it downloads the package first which is 2.5Gb ish, and then tries to unpack/verify that there's enough space for the actual installation, which requires a lot more, and fails here with a miserable generic error message if there isn't enough.

The error message itself should also be clearer and indicate that the reason for failure is not enough hard drive space for the installation.

My guess is you'll need about 10Gb+.

0

Two simple solutions. 1) remove old X-Code install, restart, and re-download. or 2) Circumvent the app store, and download image direct here http://adcdownload.apple.com/Developer_Tools/xcode_6.1.1/xcode_6.1.1.dmg

0

Make sure your Mac OS is up to date. I was having these issues updating XCode and tried many of the solutions on this page, however, it took updating the OS to fix the issue.

0

Xcode is a very large package, and it's possible that it's using problematic RAM that normally isn't an issue. If you do have a problem with your RAM, then it will likely show up as a download error (checksum error) for Xcode. So, for me the solution was to check RAM using Rember, and bingo, one of my RAM modules was defective.

0

This will sound crazy, but Xcode starts downloading when you start to update a macOS, turn off the wifi, then turn on the wifi and try downloading Xcode.

1
  • Works quite well.
    – Esh K
    Dec 14, 2017 at 13:20
0

It's possible when there is a update waiting on your macOS. In my case error disappear after installing "macOS High Sierra 10.13.3 Supplementary Update".

0

I tried almost every proposed solution.

None worked.

Then I went to Applications and saw that xCode had an icon showing how much of it was downloaded. Just double clicked on it, and continued downloading dmg file.

Had to do the same a few times, but now it's installed and working!

-1

I have solved this by using CCleaner (free trial) to clear temporary files. Worked for me after relaunching the Mac App Store.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .