Posted by: Tharindu | June 9, 2010

How to resume a broken XCode Download using Safari

It has been a pain for me to make this 2.x GB XCode download successful with my slow ADSL connection. When I first tried, it was broken at over 1 GB then again I had to start over again. Finally with help of apple forums and Google I was able to stick to a successful method. In this case you have to start your download in Safari, and if its broken you can resume it anytime by following a little trick.

1. Login with iPhone Developer account in Safari Browser and start your download. In case you break the download, which would definately happen in a slow connection that takes around 10 – 12 hours to complete.

2. Once it’s broken Right click on broken download and click Show In Finder

3. You will see a file with ‘xcode_3-1.2.3_and_iphone_sdk_4x.dmg.download’ like some thing. Right click on that and click on ‘Show Package Contents’

4. Safari keeps a Info.plist file with download progress that is the one we are going to use for our purpose. Open it with a text editor and notice there’s key value pairs. Notice the key value pairs below.

<key>DownloadEntryIdentifier</key>

<string>551E5CEA-1FCF-414E-98AD-F0CFF5E05CEE</string>

<key>DownloadEntryProgressBytesSoFar</key>

<integer>192729290</integer>

5. Now you can’t resume this download, that has lots of bytes already downloaded.Do this to use the already downloaded file.

6. First start a new download again in Safari and stop it. Then again go to finder and ‘Show Package Contents’ of this new download.

7. Here also you will see an Info.plist file open it and copy the Download Entry Identifier value.

8. Hay now you are done, paste this to the old Info.plist file. Go to Safari you will see that your old download is now resuming. Saves a lot of time for you on a slow Internet Connection.

Have fun with XCode then.


Responses

  1. This doesn’t seem to work with the current version of Safari. Instead, I used wget and Firefox, with the Export Cookies extension. I went to all of this bother because I am near the end of my download quota for the month and I don’t have enough bandwidth to redownload 2.5gb of the 3.5gb download.

    First, I got the wget binary for OSX from here: http://www.statusq.org/wp-content/uploads/2008/07/wget.zip

    Then I got the actual download link out of the Info.plist file of your broken download. Similar to above, right click the broken download in the Downloads list in Safari, show in Finder, Show Package Contents and then open the Info.plist file. At the very end of this file there will be a DownloadEntryUrl key entry.

    For me it was http://adcdownload.apple.com/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg

    You can’t just point wget at this file because wget needs the cookies which will convince apple that you are logged in. I didn’t find an easy way to get Safari’s cookies so I moved to Firefox.

    In Firefox, I installed the “Export Cookies” extension and restarted. Then, I logged in to the Apple dev site and started a new download of xcode (just to make sure I was really logged in).

    Then, under Tools in Firefox, I selected “Export Cookies..” and let it save them in ~/Documents/cookies.txt which is the default.

    Then in Terminal, I moved into the incomplete Safari download directory:

    cd ~/Downloads/xcode_3-5.2.5_and_ios_sdk_4.2_final.dmg.download/

    and got wget to resume the file:

    ~/Downloads/wget/wget –no-check-certificate –load-cookies=/Users/pix/Documents/cookies.txt -c http://adcdownload.apple.com/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg

    And now wget is resuming the file from where Safari finished… Phew that was a lot of work 😉

    pix

    Like

  2. Just an extra note, I mentioned I started a download from Apple in Firefox, but I didn’t make it clear that I cancelled this download before resuming with wget.

    pix

    Like

  3. Thanks pix. This could really save time for someone. cool.

    Like

  4. thank you guys, very useful, the “wget” trick worked for me too, not the info.plist one. I had problems downloading the 3.6Gb-long 4.01 xcode. just be aware you should double check the characters when you copy and paste from your comment, @pix, because this will result in a non-working command. the “–” for instance is replaced with a long “-” (unicode?) character which will make the whole command break.
    besides that, now with firefox 4 the old “export cookies” won’t work any more. use the “cookie exporter” plugin instead, which is 4.0 compatible and does its job.
    cheers.

    Like

  5. Fantastic – doubling continued as I type. Worked great for me on windows. Initially had the issue of the double “-” in my wget command. Doing a wget –help, makes you realise that pretty much all their commands start with double “-“

    Like

  6. This post is a LIFESAVER!!!! Stuck at 3.79 GB out of 4.1 GB download… and this thing did the trick!! Thanks a lot!! 🙂

    Like


Leave a comment

Categories