Skip to main content

Has anyone done the latest XCode release, XCode 7.0.1? I am trying to do, trying to deploy XCode 7.0.1 to developers as fast and efficiently as possible, and running into problems. Go figure.

So with BETA5 you could deploy the DMG and just have a post install script to handle the actual install, however the latest full version (7.0.1) is different. When you launch (mount) the downloadable DMG file it comes up with a GUI, that tells you to drag the XCode.app to Applications, which extracts XCode from the DMG to Applications.

Is there any scripting magic that can be preformed to accomplish this without having to extract the XCode.app (8gigs) from XCode.dmg (4gigs). That way I am not deploying 8gigs to hundreds of users?

Thanks,

Will

Hi guys,

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


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.


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


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.


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!


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


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.


@homepup Which script did you add that line to?


@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

Has anyone tried the script on xcode 9 yet?


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

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