How to download Xcode or other developer tools in a resumable way
Asked Answered
V

3

14

I have an unstable Internet connection and I need the download to be resumable. I tried using wget:

  1. Logged in to https://developer.apple.com/account
  2. Then went here https://developer.apple.com/download/more
  3. Copied the download link for Xcode 8 which is http://adcdownload.apple.com/Developer_Tools/Xcode_8/Xcode_8.xip
  4. I tried to $ wget http://adcdownload.apple.com/Developer_Tools/Xcode_8/Xcode_8.xip but I only got this on the terminal:

    --2016-09-21 15:13:17-- http://adcdownload.apple.com/Developer_Tools/Xcode_8/Xcode_8.xip Resolving adcdownload.apple.com... 203.177.38.83, 203.177.38.120 Connecting to adcdownload.apple.com|203.177.38.83|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: http://developer.apple.com/unauthorized/ [following] URL transformed to HTTPS due to an HSTS policy --2016-09-21 15:13:17-- https://developer.apple.com/unauthorized/ Resolving developer.apple.com... 17.146.1.15 Connecting to developer.apple.com|17.146.1.15|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2070 (2.0K) [text/html] Saving to: ‘Xcode_8.xip’

    Xcode_8.xip 100%[==================================>] 2.02K --.-KB/s in 0s

    2016-09-21 15:13:18 (85.8 MB/s) - ‘Xcode_8.xip’ saved [2070/2070]

Vanettavang answered 21/9, 2016 at 7:18 Comment(6)
i want it to be resumable because i have an unstable connection.Vanettavang
Yes, You are use safari browser to download xcode 8....!!!Bealle
yep, i know that. but i want to use wget insteadVanettavang
mownier, did you find a way to download xcode with wget?Malefactor
@Malefactor yes, i did. login first in to your developer account. copy the download link. then use the stored cookie used to authenticate your access on the download link. finally, use the wget command using a cookie flag argument.Vanettavang
@Vanettavang added the answer to explain details as well as updated question to make it generic for all types of downloads. Please accept it if it is to your liking.Lenorelenox
L
11

Apple developer account downloads are tracked using browser cookies to check their validity and the download is flaky and fails quite regularly especially on a slower internet connection. The way around is using wget but it fails by default because those cookies are missing. The solution is to export the cookies from a browser and then use them along with wget as follows.

For example downloading XCode 9 beta from developer account copy the XCode 9 download url and use wget as follows.

wget --load-cookies=cookies.txt -c https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_9_beta_6/Xcode_9_beta_6.xip

This should start downloading in the same directly as it is run and in case it cancels or fails because of flaky connection just run the same command again in the same directory as before and it should resume just fine.

There are a lot of different ways to export cookies from the browser. I use chrome browser and cookies.txt is a decent option. I in no way endorse this product and many other solutions in different browsers should work just as well. A quick google should help. NOTE: for some reason cookies.txt only works if I only export cookies for the developer.apple.com website and doesnt work if I export all cookies from browser.

Lenorelenox answered 3/9, 2017 at 6:27 Comment(0)
B
1

To have the download resume when your connection drops, use Safari to download it. It correctly resumes downloads after the connection is restored and you click the orange "Resume downloading" icon next to the download.

I just tested this with Safari 11 to be certain, but I've used Safari's ability to resume downloads from Apple Developer for about 12 years now.

Beason answered 4/9, 2017 at 1:25 Comment(1)
Safari does not auto 'Resume' this anymore in MacOS High SierraKendallkendell
A
1

I was able to download the Xcode xip file in just 18 mins that would take 2-3 hours on the internet speed i have by following this blog link (credits to the author). Moreover, it resumed automatically after getting internet again. For simplifying i am listing the steps.

  1. Save the script mentioned at the link in a file (filename.rb)
  2. Run the script through terminal (ruby filename.rb)
  3. Get cookie from chrome
    -Open https://developer.apple.com/download/more/
    -Open developer tools -> Cookies -> ADCDownloadAUTH
    -Copy this Cookie and pass this cookie in input (when script will ask) and URL URL:https://download.developer.apple.com/Developer_Tools/Xcode_10.2/Xcode_10.2.xip
Au answered 2/10, 2019 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.