I've search for this topic a bit, but can't find an answer. So I'm typing up a new question.
I install the latest XCode onto the Mac. During first start up, it will have this screen
I would then click on install, and type in my admin password to perform the installation.
Now I want to automate this step, as I want to do this on multiple build agents that will regularly get the latest XCode available. Is there any command or script that will trigger this off?
I added this line to Rich's code and it now works, there is an additional package which now needs installed which isn't in the original script.
if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/XcodeExtensionSupport.pkg" ]]; then
/usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/XcodeExtensionSupport.pkg" -target /
We deploy our Xcode with the version number appended to the filename so that our developers can pick which version they want to used. We deploy the application then run the following three lines which work well.
sudo xcode-select -s /Applications/Xcode 10.0.app/Contents/Developer
sudo /usr/bin/xcodebuild -runFirstLaunch'
sudo /usr/bin/xcodebuild -license accept
(based on @rtrouton work)
#!/bin/sh if [ -e /Applications/Xcode.app ] then sudo xcodebuild -license accept # make sure all users on this machine are members of the _developer group /usr/sbin/dseditgroup -o edit -a everyone -t group _developer # enable developer mode /usr/sbin/DevToolsSecurity -enable # accept Xcode license /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license accept # install embedded packages # cd /Applications/Xcode.app/Contents/Resources/Packages/ sudo installer -pkg MobileDevice.pkg -target / sudo installer -pkg MobileDeviceDevelopment.pkg -target / # sudo installer -pkg XcodeExtensionSupport.pkg -target / ## no longer required sudo installer -pkg XcodeSystemResources.pkg -target / exit 0 else echo "waiting for app trying again at next checkin" exit 0 fi