Posted on 09-11-2018 09:31 PM
Hi all,
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?
Posted on 09-11-2018 10:10 PM
It used to be that you could script the contents of /Applications/Xcode.app/Contents/Resources/Packages to install as part of the initial install, but that doesn't seem to do it any longer. I haven't found a solve for this yet.
Posted on 09-11-2018 11:55 PM
https://www.jamf.com/jamf-nation/discussions/21248/deploying-xcode-8-via-self-service-a-how-to
Posted on 09-12-2018 02:54 AM
Try this
https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/xcode_post_install_actions
Posted on 09-12-2018 05:13 AM
I can confirm that the script on rtouton's github page does work with xcode 9.4.1.
Posted on 09-17-2018 01:00 AM
I'm getting that as well, I've tried Rich's script and a number of others without success.
Posted on 09-17-2018 05:10 AM
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 /
fi
Posted on 09-18-2018 12:34 PM
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
Posted on 09-18-2018 10:01 PM
try this:
(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
Posted on 09-18-2018 10:03 PM
and yes you don't need the sudo.....
Posted on 09-18-2018 10:42 PM
this is worth looking at, very recent and carl's work is solid: https://github.com/carlashley/xcode_tools
Posted on 11-17-2020 10:27 AM
So, it looks like Apple has made this much easier now - don't know when they did it, but running the command:
sudo /usr/bin/xcodebuild -runFirstLaunch
Will accept the license and install all additional components.