Skip to main content
Question

Deploying Xcode in 2021


Forum|alt.badge.img+6

Is anyone deploying Xcode component through the 'Self Services' option with any success?
or how to automate the "install additional component" without Admin

i have try this... but no success , always asking admin authority

#!/bin/bash

if [[ -d /Applications/Xcode.app ]]; then
  echo "Xcode installed"
  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license accept
  /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -runFirstLaunch  #This installs the Additional Components
  /usr/sbin/DevToolsSecurity -enable
  dseditgroup -o add everyone -t group _developer
else
  echo "Xcode not installed"
  exit 1
fi

10 replies

Jason33
Forum|alt.badge.img+13
  • Honored Contributor
  • 223 replies
  • May 3, 2021

I could never get a script to work, so I deploy it as a Mac App Store app. It takes forever, but seems to get the job done (at least no one has complained yet)


Forum|alt.badge.img+6
  • Author
  • New Contributor
  • 9 replies
  • May 4, 2021

@Jason33 thank reply~
So i just have to be like this

it will automate the "install all additional component" ? or i need to do something?


Forum|alt.badge.img+1
  • New Contributor
  • 2 replies
  • August 19, 2021

create a post Xcode install script that will allow the all users of that station to be a developer admin.

#!/bin/bash # Accept EULA so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]]; then "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" -license accept fi # Just in case the xcodebuild command above fails to accept the EULA, set the license acceptance info # in /Library/Preferences/com.apple.dt.Xcode.plist. For more details on this, see Tim Sutton's post: # http://macops.ca/deploying-xcode-the-trick-with-accepting-license-agreements/ if [[ -e "/Applications/Xcode.app/Contents/Resources/LicenseInfo.plist" ]]; then xcode_version_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/"Info CFBundleShortVersionString` xcode_build_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseID` xcode_license_type=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseType` if [[ "${xcode_license_type}" == "GM" ]]; then /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastGMLicenseAgreedTo "$xcode_build_number" else /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToBetaLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastBetaLicenseAgreedTo "$xcode_build_number" fi fi # 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/Xcode.app # Bypass Gatekeeper verification for Xcode, which can take awhile. if [[ -e "/Applications/Xcode.app" ]]; then xattr -dr com.apple.quarantine /Applications/Xcode.app fi # Install Mobile Device Packages so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" -target / fi if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" -target / fi # Install XcodeSystemResources.pkg so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" -target / fi exit 0

Forum|alt.badge.img+6
  • Author
  • New Contributor
  • 9 replies
  • September 9, 2021
rallende wrote:

create a post Xcode install script that will allow the all users of that station to be a developer admin.

#!/bin/bash # Accept EULA so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]]; then "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" -license accept fi # Just in case the xcodebuild command above fails to accept the EULA, set the license acceptance info # in /Library/Preferences/com.apple.dt.Xcode.plist. For more details on this, see Tim Sutton's post: # http://macops.ca/deploying-xcode-the-trick-with-accepting-license-agreements/ if [[ -e "/Applications/Xcode.app/Contents/Resources/LicenseInfo.plist" ]]; then xcode_version_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/"Info CFBundleShortVersionString` xcode_build_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseID` xcode_license_type=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseType` if [[ "${xcode_license_type}" == "GM" ]]; then /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastGMLicenseAgreedTo "$xcode_build_number" else /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToBetaLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastBetaLicenseAgreedTo "$xcode_build_number" fi fi # 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/Xcode.app # Bypass Gatekeeper verification for Xcode, which can take awhile. if [[ -e "/Applications/Xcode.app" ]]; then xattr -dr com.apple.quarantine /Applications/Xcode.app fi # Install Mobile Device Packages so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" -target / fi if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" -target / fi # Install XcodeSystemResources.pkg so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" -target / fi exit 0

wow~very cool ~

I have time to try it out! Thank you very much!


Forum|alt.badge.img+1
  • New Contributor
  • 2 replies
  • November 13, 2021

Late to the party and not sure if this is remotely helpful, but I was able to use user-based assignment with JAMF/Apple Business Manager to expose the Xcode install under "Purchased" in the App Store. So once the user logs into the App Store with their Managed Apple ID they can install it right from there.


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • March 11, 2022
rallende wrote:

create a post Xcode install script that will allow the all users of that station to be a developer admin.

#!/bin/bash # Accept EULA so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" ]]; then "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" -license accept fi # Just in case the xcodebuild command above fails to accept the EULA, set the license acceptance info # in /Library/Preferences/com.apple.dt.Xcode.plist. For more details on this, see Tim Sutton's post: # http://macops.ca/deploying-xcode-the-trick-with-accepting-license-agreements/ if [[ -e "/Applications/Xcode.app/Contents/Resources/LicenseInfo.plist" ]]; then xcode_version_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/"Info CFBundleShortVersionString` xcode_build_number=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseID` xcode_license_type=`/usr/bin/defaults read "/Applications/Xcode.app/Contents/Resources/"LicenseInfo licenseType` if [[ "${xcode_license_type}" == "GM" ]]; then /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastGMLicenseAgreedTo "$xcode_build_number" else /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDEXcodeVersionForAgreedToBetaLicense "$xcode_version_number" /usr/bin/defaults write "/Library/Preferences/"com.apple.dt.Xcode IDELastBetaLicenseAgreedTo "$xcode_build_number" fi fi # 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/Xcode.app # Bypass Gatekeeper verification for Xcode, which can take awhile. if [[ -e "/Applications/Xcode.app" ]]; then xattr -dr com.apple.quarantine /Applications/Xcode.app fi # Install Mobile Device Packages so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg" -target / fi if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg" -target / fi # Install XcodeSystemResources.pkg so there is no prompt if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" ]]; then /usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg" -target / fi exit 0

hello, 

can you tell me how and where i have to execute this script ? I'm not comfortable with script ^^


Forum|alt.badge.img+2
  • New Contributor
  • 24 replies
  • April 18, 2022

Xcode 13.3.1

I was deploying the app with munki

The post install script above did not stop the prompts at initial xcode launch

I tried deploying the app with JAMF as an app store app, which worked to install it, but didn't bypass any of the prompts.

There is an additional resource that the script needs to install, CoreTypes.  After I added thew following to the script, Xcode launches with no prompts:

 

if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/CoreTypes.pkg" ]]; then
/usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/CoreTypes.pkg" -target /
fi

 


SMR1
Forum|alt.badge.img+13
  • Valued Contributor
  • 218 replies
  • May 6, 2022
jwaltonen wrote:

Xcode 13.3.1

I was deploying the app with munki

The post install script above did not stop the prompts at initial xcode launch

I tried deploying the app with JAMF as an app store app, which worked to install it, but didn't bypass any of the prompts.

There is an additional resource that the script needs to install, CoreTypes.  After I added thew following to the script, Xcode launches with no prompts:

 

if [[ -e "/Applications/Xcode.app/Contents/Resources/Packages/CoreTypes.pkg" ]]; then
/usr/sbin/installer -dumplog -verbose -pkg "/Applications/Xcode.app/Contents/Resources/Packages/CoreTypes.pkg" -target /
fi

 


jwaltonen, I'm new to Jamf and we're just starting to roll out to some test devices. For additional resource you had to add for CoreTypes, did you just add it to the bottom of the above script?


Forum|alt.badge.img+2
  • New Contributor
  • 24 replies
  • May 9, 2022
SMR1 wrote:

jwaltonen, I'm new to Jamf and we're just starting to roll out to some test devices. For additional resource you had to add for CoreTypes, did you just add it to the bottom of the above script?


yes


Forum|alt.badge.img+2
  • New Contributor
  • 24 replies
  • June 30, 2022

So, as I am now deploying xcode with jamf and I have the boxes checked to automatically update the app.  It seems like when JAMF updates the app the post install script needs to be run again because the app stopped opening and started asking for additional items to be installed. again 

To resolve this issue, I just made my policy that ran the post xcode install script referenced above in this thread, from occurring once to occurring at every checkin.  Theres probably a more elegant way to trigger it.

Just sharing.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings