Skip to content

Instantly share code, notes, and snippets.

@SergLam
Last active April 10, 2024 20:14
Show Gist options
  • Save SergLam/3adb64051a1c8ebd8330191aedcefe47 to your computer and use it in GitHub Desktop.
Save SergLam/3adb64051a1c8ebd8330191aedcefe47 to your computer and use it in GitHub Desktop.
XCode quick install / update
// Original video tutorial
// https://www.youtube.com/watch?v=6iSuc2vxT8g
// 0. Install a Homebrew
// https://brew.sh/
// 1. Install Ruby to your Mac
// brew install ruby
// 2. Install aria2 tool
// Source code:
// https://github.com/aria2/aria2
// Download page:
// https://aria2.github.io/
// Homebrew command
// brew install aria2
// 3. Find out direct link for XCode downloading at Developer portal:
// https://developer.apple.com/download/more/
// NOTE: Sometimes https URL give 403 error, so use http url instead
// Example link
// http://download.developer.apple.com/Developer_Tools/Xcode_11.3/Xcode_11.3.xip
// 4. Get you ADCDownloadAuth cookie token:
// NOTE: Be careful and make sure you copied full token string
// GoogleChrome -> Developer Tools -> Application -> Storage -> Cookies
// Example: ZVpgnDEjb1bu74wsEBVoiMNWMP7qY1HF9C%2B9ynsD0LgEbizSthUuPAqczwOWCTW6ycnKrNGsEYjO%0D%0A99uxltv5%2FMmmOXy6Q4sDzS2s57i4qWcLSiinBfnLIARwCXkxJzxEjJnIupYMy2Q5T5q%2BbUe7KYvN%0D%0AbvB5WYT0ZcVX5%2F%2BbypEfFl7y%0D%0A
// 5. Execute ruby script - see below
// ruby xcode-downloader.rb
// 6. Paste requested values to terminal from steps 3 and 4
// XCode will be downloaded during 10 minutes, but not for a 1 hour.
// Appreciate your time!
// UITool that uses Aria 2 under the hood:
https://github.com/vineetchoudhary/Downloader-for-Apple-Developers
#!/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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment