I'm using TeamCity 8.0.5 hosted on a Mac, and I have a second Mac setup as my build agent with both Xcode 3.2.6 and Xcode 4.6.2 installed. The projects that I am using require specific IDE versions, no thanks to Adobe SDK, and I can't seem to setup TeamCity to specify which version of Xcode to use for the build.
If I use the xcode-select
command, I can manually set the build to either version of Xcode before I start the build and both go through without a hitch.
I attempted to add a new build step with a 'Command Line' Runner type with the following command:
xcode-select -switch /Developer/Xcode3/
However the xcode-select command needs to be run as a sudoer. When I added a sudo
prefix on the line, I got the following error:
Step 1/3: Switch xcodeBuild to Xcode3 (Command Line)
[Step 1/3] Starting: /Applications/TeamCity/buildAgent/temp/agentTmp/custom_script12345
[Step 1/3] in directory: /Applications/TeamCity/buildAgent/work/12345
[Step 1/3] Sorry, try again.
[Step 1/3] Sorry, try again.
[Step 1/3] Sorry, try again.
[Step 1/3] sudo: 3 incorrect password attempts
[Step 1/3] Process exited with code 1
I attempted the fix by writing the command to a bash script, placing the script at a local file path, and opening up execute permissions. This got me a little farther:
Step 1/3: Switch xcodeBuild to Xcode3 (Command Line)
[Step 1/3] Starting: /xcode.sh
[Step 1/3] in directory: /Applications/TeamCity/buildAgent/work/12345
[Step 1/3] sudo: no tty present and no askpass program specified
I was able to find this post on StackOverflow on how to fix the tty problem, but I was only able to call the script a few times before being prompted for a password from the script again. I'm not sure if being logged into the computer locally or via SSH keeps the script working, or if modifying the /etc/sudoers file has the same effect on a Mac as it does on a Linux distro.
I think I'm looking for a better way to either run a sudo command from a Command Line or select another version of Xcode from TeamCity.
Thanks for reading this long post!