Skip to content

Instantly share code, notes, and snippets.

@manishpathak99
Forked from iandundas/xcode-downloader.rb
Created October 30, 2017 09:10
Show Gist options
  • Save manishpathak99/2a18fce18493f460fe80f2bd542a8560 to your computer and use it in GitHub Desktop.
Save manishpathak99/2a18fce18493f460fe80f2bd542a8560 to your computer and use it in GitHub Desktop.
Script for reliably downloading binaries (e.g. Xcode) from Apple's CDN
#!/usr/bin/env ruby
print "What is the URL of your Apple Downloads resource?\nURL:"
url = gets.strip
print "What is the ADCDownloadAuth cookie token:\nADCDownloadAuth: "
token = gets.strip
command = "aria2c --header \"Host: adcdownload.apple.com\" --header \"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\" --header \"Upgrade-Insecure-Requests: 1\" --header \"Cookie: ADCDownloadAuth=#{token}\" --header \"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_1 like Mac OS X) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0 Mobile/14B72 Safari/602.1\" --header \"Accept-Language: en-us\" -x 16 -s 16 #{url} -d ~/Downloads"
exec(command)
@raju249
Copy link

raju249 commented Oct 24, 2020

Just a small change in this if it doesnt work and returns 403, you can replace the https from the link to http

@guarani
Copy link

guarani commented Nov 9, 2020

Just a small change in this if it doesnt work and returns 403, you can replace the https from the link to http

Thanks for the tip! Download started once I changed to http...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment