Skip to main content
Question

XCode 7.0.1.DMG Deployment

  • October 16, 2015
  • 36 replies
  • 153 views

Show first post

36 replies

Forum|alt.badge.img
  • New Contributor
  • April 13, 2016

Hi guys,

Thanks for post-install scripts.
Just wanted tom mention xcode-install, which can help somehow.


AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • April 13, 2016

As a result of the recent incident where a fake XCode was distributed to Chinese users and caused all kinds of mayhem, I don't think it would would be a good idea to download XCode from anywhere but directly from Apple.


Forum|alt.badge.img+14
  • Valued Contributor
  • May 19, 2016

took a look at xcode-install, you could script this
gem install fastlane
gem install xcode-install
fastlane-credentials add ?????
xcversion install 7.3.1
xcversion install-cli-tools


AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • May 25, 2016

FYI, I was able to confirm that Xcode 7.3.1 does install and the standard post-install scripts we've all been using does finally work, and xcode now no longer prompts to install additional components. Unfortunately it looks like 7.3.1 is only for running on OSX 10.11.x.


Forum|alt.badge.img+22
  • Honored Contributor
  • September 12, 2016

Silly question, probably an easy answer. Wondering why the script above didn't run to install the tools and realized xcode installed right to the HD rather that /Applications. Fill me in on why a DMG would install an app to the HD, not /Applications?

Also, anyone get the "Xcode 7 library documentation" to install with this?

Thanks!
PS, such a helpful post, in a time jam for a deployment and it looks like this is going to be perfect!


Forum|alt.badge.img+22
  • Honored Contributor
  • September 13, 2016

@bpavlov @AVmcclint Just wanted to say thanks for all the info here, works beautifully in conjunction with Rich Trouton's MAS process.


Forum|alt.badge.img+8
  • Contributor
  • February 9, 2017

Had a similar issue happen with Xcode 8.2.1 on macOS 10.12.3. Found that once I added this line to my scripts to also install:

/usr/sbin/installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target /

It seemed MUCH happier.


Forum|alt.badge.img
  • New Contributor
  • February 16, 2017

@homepup Which script did you add that line to?


Forum|alt.badge.img+8
  • Contributor
  • February 21, 2017

@stefmo Unfortunately, I'm not a JAMF user (still trying to convince the check-writers that it's worth it and will maybe allow my hair to grow back from less stress if we get it), but I cruise the forums for help and advice, so this was just a line added to my particular Xcode installation scripts for after imaging. Here's a copy of my current version (giving credit where it is due since 90% of this is borrowed from various sources/people/forums):

#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin export PATH

# Script to install Xcode components after initial installation (agree to license & mobile components installation)
echo "%95"

# exclude xcode from gatekeeper verification, which can take hours.
if [[ -e "/Applications/Xcode.app" ]]; then xattr -dr com.apple.quarantine /Applications/Xcode.app
fi

# Accept Xcode License
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -license accept

# Install Additional Components
/usr/sbin/installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/MobileDevice.pkg -target /

/usr/sbin/installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/MobileDeviceDevelopment.pkg -target /

/usr/sbin/installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg -target /

# Installing the Xcode command line tools on 10.7.x or higher

osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"

# Installing the latest Xcode command line tools on 10.9.x or higher

if [[ "$osx_vers" -ge 9 ]]; then

    # Create the placeholder file which is checked by the softwareupdate tool 
    # before allowing the installation of the Xcode command line tools.

    touch "$cmd_line_tools_temp_file"

    # Find the last listed update in the Software Update feed with "Command Line Tools" in the name

    cmd_line_tools=$(softwareupdate -l | awk '/* Command Line Tools/ { $1=$1;print }' | tail -1 | sed 's/^[[ 	]]*//;s/[[ 	]]*$//;s/*//' | cut -c 2-)

    #Install the command line tools

    softwareupdate -i "$cmd_line_tools" --verbose

    # Remove the temp file

    if [[ -f "$cmd_line_tools_temp_file" ]]; then
      rm "$cmd_line_tools_temp_file"
    fi
fi
sleep 5

# 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
/usr/sbin/dseditgroup -o edit -a everyone -t group _developer

echo "Xcode installations complete"

exit 0

AVmcclint
Forum|alt.badge.img+21
  • Esteemed Contributor
  • September 20, 2017

Has anyone tried the script on xcode 9 yet?


Forum|alt.badge.img+9
  • Contributor
  • January 4, 2018

As of xcode 9 you will need this line added to the script

installer -pkg /Applications/Xcode.app/Contents/Resources/Packages/XcodeExtensionSupport.pkg -target /