Skip to main content
Jamf Nation, hosted by Jamf, is the largest Apple IT management community in the world. Dialog with your fellow IT professionals, gain insight about Apple device deployments, share best practices and bounce ideas off each other. Join the conversation.
CCA Badge CJA Badge

Deploying Xcode 8 via Self-Service - a how-to

Posted: 9/15/16 at 9:56 AM by RobertHammen

Worked this out with @rtrouton based on both his installation script as well as the one located at

Wanted to offer Xcode 8 (requires OS X 10.11.5 or later) to our user population via Self Service.

Downloaded the Xcode 8 installation package from the App Store using the App Store Capture Methodology (yes, VPP would be better), described at:

Added the 4.43GB installation package to the JSS, created a Self Service policy to install it, and used this script below (set to Run After) to handle all of the post-installation processing (so that users are not prompted for admin credentials). You may want to customize the script for your environment (we don't disable the Gatekeeper validation, and our users are already developers, nor do we have multiple versions of Xcode installed, so those line-items are disabled, but it's your call):


# Accept EULA so there is no prompt

if [[ -e "/Applications/" ]]; then
  "/Applications/" -license accept

# Just in case the xcodebuild command above fails to accept the EULA, set the license acceptance info 
# in /Library/Preferences/ For more details on this, see Tim Sutton's post: 

if [[ -e "/Applications/" ]]; then

   xcode_version_number=`/usr/bin/defaults read "/Applications/"Info CFBundleShortVersionString`
   xcode_build_number=`/usr/bin/defaults read "/Applications/"LicenseInfo licenseID`
   xcode_license_type=`/usr/bin/defaults read "/Applications/"LicenseInfo licenseType`

   if [[ "${xcode_license_type}" == "GM" ]]; then
       /usr/bin/defaults write "/Library/Preferences/" IDEXcodeVersionForAgreedToGMLicense "$xcode_version_number"
       /usr/bin/defaults write "/Library/Preferences/" IDELastGMLicenseAgreedTo "$xcode_build_number"
       /usr/bin/defaults write "/Library/Preferences/" IDEXcodeVersionForAgreedToBetaLicense "$xcode_version_number"
       /usr/bin/defaults write "/Library/Preferences/" IDELastBetaLicenseAgreedTo "$xcode_build_number"


# DevToolsSecurity tool to change the authorization policies, such that a user who is a
# member of either the admin group or the _developer group does not need to enter an additional
# password to use the Apple-code-signed debugger or performance analysis tools.

/usr/sbin/DevToolsSecurity -enable

# Add all users to developer group, if they're not admins

/usr/sbin/dseditgroup -o edit -a everyone -t group _developer

# If you have multiple versions of Xcode installed, specify which one you want to be current.

/usr/bin/xcode-select --switch /Applications/

# Bypass Gatekeeper verification for Xcode, which can take awhile.

if [[ -e "/Applications/" ]]; then xattr -dr /Applications/

# Install Mobile Device Packages so there is no prompt

if [[ -e "/Applications/" ]]; then
  /usr/sbin/installer -dumplog -verbose -pkg "/Applications/" -target /

if [[ -e "/Applications/" ]]; then
  /usr/sbin/installer -dumplog -verbose -pkg "/Applications/" -target /

# Install XcodeSystemResources.pkg so there is no prompt

if [[ -e "/Applications/" ]]; then
  /usr/sbin/installer -dumplog -verbose -pkg "/Applications/" -target /

exit 0
CCA Badge CCE Badge CMA Badge Integrator Badge

Posted: 9/15/16 at 11:35 AM by Echevarria

Awesome work gentleman. I'll try this out later today, you have made this request so much easier.
Muy bueno.

CCA Badge CCE Badge CMA Badge CUG Badge

Posted: 9/21/16 at 2:36 AM by donmontalvo

Wow...I may owe @RobertHammen a beer, and @rtrouton a Pepsi at JNUC2016...if they're going this year. :)

PS, any way to get the Additional Components installed without having to snapshoot? Thought the last two sections to install PKGs would eliminate that?

CCA Badge CJA Badge

Posted: 9/21/16 at 11:38 AM by RobertHammen

@donmontalvo Not seeing that. Are you sure the script is running? Because it should handle the licensing and install the components...

CCA Badge CCE Badge CMA Badge CUG Badge

Posted: 9/21/16 at 1:01 PM by donmontalvo

@RobertHammen hmm...I'll double check now, will shout back.

Posted: 10/27/16 at 9:21 PM by MaCaDmIn82

@donmontalvo @RobertHammen @rtrouton

I get the prompt when going to xcode - preferences - components and i try to download an ios simulator
What part of this script is actually covering this?
Im running versions 7.3.1, 8.0 and 8.1GMSeed
Help please

CCA Badge CJA Badge

Posted: 11/9/16 at 1:15 PM by RobertHammen

@MaCaDmIn82 Simulators are a different story.

Some of the info documented here is still relevant:

Tim Sutton's Blog

Basically, you can start the download on your Mac, and the downloads still go to:


However, be aware:

1) the dmg files don't show up in the Finder, at least on my Mac (had to use Terminal)
2) after I mounted one of those dmg's, they also appeared empty/the pkg files had to be accessed/copied via Terminal

Might just be an anomaly on my Mac.

Anyway, you'd have to capture the .pkg files for the simulators, and install them/check where the files were actually installed - if in the Xcode app bundle itself, or in /Library, you're OK, but if in the ~/Library folder hierarchy, obviously you have a larger issue...

Posted: 1/10/17 at 10:23 AM by dferrara

@RobertHammen Great work and thank you for sharing!

Posted: 1/31/17 at 1:17 PM by ctarbox

@RobertHammen... Newbie here. Just wanted to say I tested this approach and it worked flawlessy (El Cap 10.11.6/xCode 8.2.1).

And learning how to capture. pkg's from MAS was very helpful too.

Posted: 3/28/17 at 2:23 PM by baldiesrt

The debug menu is gone in Sierra.

Use this link instead of the one above to get the package from MAS

Posted: 3/29/17 at 10:06 AM by baldiesrt


Posted: 3/29/17 at 4:47 PM by jazzyj

Just out of interest, why not download Xcode directly from

CCT Badge

Posted: 3/30/17 at 10:27 AM by dstranathan

It still requires a "hop" from a browser to the Mac App Store app (and an Apple ID etc). It's not a "direct" download, correct?

CCA Badge CJA Badge

Posted: 3/30/17 at 4:47 PM by RobertHammen

@jazzyj When I go to download Xcode from it takes me right to the App Store to download. Previous versions on that site have a .XIP file which is significantly larger than the App Store .pkg file, and to which no native tools can use.

Posted: 4/12/17 at 9:02 AM by dfarnworth_barc

If you go to, and click Downloads on the left then scroll to the bottom, there's a link saying: "Don't see what you're looking for? See more downloads", click that and you can download the XIP. Or the direct URL is