I am trying to download Xcode from the Apple Developer site using just wget or curl. I think I am successfully storing the cookie I need to download the .dmg file, but I am
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 and it 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 "> " USERNAME
echo "Enter your Apple Dev Center password."
read -p "> " PASSWORD
curl \
-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.html
ACTION=$(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/null
curl \
-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.html
rm cookies