Closed tyilo closed 12 years ago
Must have "Hit the Enter key to view the license agreements" expression as well. Otherwise this will not work if you run the script for the very first time.
#!/usr/bin/env expect -f
set timeout -1
spawn sudo xcodebuild -license
expect {
"Password"
{
stty -echo
expect_user -re "(.*)\n"
stty echo
set pass $expect_out(1,string)
send -- "$pass\r"
exp_continue
}
"incorrect password attempts"
{
exit 1
}
"Hit the Enter key to view the license agreements"
{
send "\r"
exp_continue
}
"Press 'space' for more"
{
send " "
exp_continue
}
"By typing 'agree'"
{
send "agree\r"
exp_continue
}
}
Nice script. But I myself do not want to provide a script that auto-accepts a license for another person. I leave it to the end-user to do so.
this is very useful in case where i have a build farm with 100 macs and every time i upgrade xcode i do not wish to log into every one just to click on license, instead use my distro tool to push the xcode package and run this in post script to get a new machine up and running
@thusithapk - Nice! Your version of the script made my life better. Thanks!
@sochoa
I give thanks to God. He is the only One who gives knowledge and understanding. Thank you Jesus!
With Xcode 5 onwards you don't need the old script. You just need this one liner.
# Accept Xcode 5+ License
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license accept
+1, for sudo xcodebuild -license accept
This script will automatically accept the xcodebuild license. If it is not run as root it will show the sudo password prompt first.