Downloading Xcode with wget or curl Downloading Xcode with wget or curl curl curl

Downloading Xcode with wget or curl


For Chrome,

  1. Install cookies.txt Chrome extension
  2. Login to Apple Developer site and get the url for downloading
  3. Run cookies.txt extension and download cookies.txt file
  4. From the cookies.txt download directory, load cookies into wget and start resumable download. For example, to download Xcode_7.dmg, you would run:

    wget --load-cookies=cookies.txt -c http://adcdownload.apple.com/Developer_Tools/Xcode_7/Xcode_7.dmg


Maybe this is the easiest way to use curl:

  • open Google Chrome.app;
  • goto site developer.apple.com;
  • press CMD+SHIFT+J or click top-right Menuicon -> Tools -> Developer Tools;
  • click Network panel;
  • now click Xcode download link at apple.com;
  • you will see one or more request records in the Network panel;
  • right click the latest record, then click Copy as cURL;

Now, you got the curl command for this download link with cookies and other http-requeset-fields, just paste to your terminal and add -o xxx.dmg at the end.


Here is a script that uses curl instead of wget, so it will work on a stock Mac.All you need to set is the path to the xcode DMG file.The script will ask you for your username and password andit will figure out the ACTION and WOSID values for you.

#!/bin/sh# Change this line to the URI path of the xcode DMG file.XCODE_PATH="/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg"echo "Enter your Apple Dev Center username."read -p "> " USERNAMEecho "Enter your Apple Dev Center password."read -p "> " PASSWORDcurl \        -L -s -k \        --cookie-jar cookies \        -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5" \        https://developer.apple.com/devcenter/ios/login.action \        -o login.htmlACTION=$(sed -n 's/.*action="\(.*\)".*/\1/p' login.html)WOSID=$(sed -n 's/.*wosid" value="\(.*\)".*/\1/p' login.html)echo "action=${ACTION}"echo "wosid=${WOSID}"curl \        -s -k --cookie-jar cookies --cookie cookies \        -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5" \        -e ";auto" "https://daw.apple.com${ACTION}?theAccountName=${USERNAME}&theAccountPW=${PASSWORD}&theAuxValue=&wosid=${WOSID}&1.Continue.x=0&1.Continue.y=0" \        > /dev/nullcurl \        -L --cookie-jar cookies --cookie cookies \        -A "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5" \        -O https://developer.apple.com/ios/download.action?path=${XCODE_PATH}rm login.htmlrm cookies