How to resume a broken ADC download

(I'm documenting this trick for myself to remember, but it can be useful for others…)

Apple, on its Apple Developer Connection site, has a bad habit of not providing small or separate SDK downloads for iOS or Mac OS X development. This means, for example, that I have to download a 4.3GB bundle for Xcode 4 and iOS SDK 4.3 to get one of those. Problem: I'm living on a small island where the local postal-and-telecommunications monopoly is better at finding ways to milk everybody to death rather than providing a fast, stable and affordable internet connection as part of its public service duties, so it's simply impossible to download gigabytes of data without being disconnected at least once. The fact is that I've never been able to download anything on ADC without fail.

Thanks to the Unix roots of Mac OS X, we have curl to the rescue. Here's how to resume a failed download on ADC:

  1. Let's say you have started to download the file xcode_4_and_ios_sdk_4.3__final.dmg but the download has been interrupted. Usually, Safari will happily pretend that the download has completed, but the DMG archive won't load. If you check the file size, it's less than it should be.
  2. Check the Finder Info for that file and look in the More Info panel where it comes from. There will probably be several URLs (because of redirections), take the first one. For me it's‌xcode_4_and_ios_sdk_4.3__final/xcode_4_and_ios_sdk_4.3__final.dmg
  3. Connect to ADC to reauthenticate
  4. In the web inspector on the ADC page, go to Storage then Cookies and note the ADCDownloadAuth cookie and its content. In curl parlance, this will translate into something like: -b "ADCDownloadAuth=<cookie value>;"
  5. And finally, in Terminal — assuming you are in the same path as the download file, get there or give the full path to the -o file option — both the -C - and the -o file options will tell curl to resume the download exactly where it stopped, and the --retry 100 will automatically retry up to 100 times in case it fails again (so it'll work unattended):

curl -b "ADCDownloadAuth=<cookie value>;" -C - --retry 100 -o xcode_4_and_ios_sdk_4.3__final.dmg‌xcode_4_and_ios_sdk_4.3__final/xcode_4_and_ios_sdk_4.3__final.dmg

Et voilà !

P.S. My CSS overflow rule cuts the long lines above so I've used a zero-width space to force line breaks, but you should get the gist.
P.S. 2: Added the --retry 100 option to let curl automatically resume the download in case it fails again.
P.S. 3: Just found this script from Michael Tyson which automates all the manual steps above (won't retry automatically, though it's easy to modify it). Very handy!


Thanks for helping!

Got resume working and finally got XCode downloaded. South Africa slow internet.....

There is a much simpler method. (which I discovered after coming here and fighting with web inspector :)!)

remove partial .dmg from downloads list

from download folder launch package which will resume download but complain about authorisation

start a new download from apple developer which will authorise.

cancel new unnecessary duplicate download

Thanks for the tip. I remember I tried it in the past but it failed, either because Safari is sometimes not foolproof at resuming broken downloads, or I didn't get the sequence in order.

I've added the '--retry 100' option to my recipe to tell curl to automatically retry the download in case it fails again. I still prefer this method, as it can work without any kind of manual intervention (yours would waste precious time if the download breaks again during the night, which happens frequently here with downloads that last for 16h).

mensuelles Archives

Recent Entries

  • Steve Jobs

    "Remembering that I’ll be dead soon is the most important tool I’ve ever encountered to help me make the big choices in life. Because...

  • Your privacy on MOTOBLUR by Motorola

    After the Nokia Ovi Store carelessness, it's now Motorola who's allowing strangers to get access to your private information on their MOTOBLUR portal. Exactly like...

  • How to resume a broken ADC download

    (I'm documenting this trick for myself to remember, but it can be useful for others…) Apple, on its Apple Developer Connection site, has a bad...

  • WTF is this ‘myEventWatcherDiv’ doing in my web?

    All of a sudden I started to find the following line in most of the web pages I was browsing, including ones I made where...

  • Your privacy on Nokia Ovi Store

    My friend Adam Greenfield recently complained about the over-engineering culture at Nokia: I was given an NFC phone, and told to tap it against the...