Quantcast
Channel: rtrouton – Der Flounder
Viewing all articles
Browse latest Browse all 764

Installing the Xcode command line tools on 10.7.x and later

$
0
0

A number of Mac admins need to provide the Xcode Command Line Tools for the Macs in their environments, either as part of building machines or afterwards. To help with this task, I’ve developed a script that will download and install the Xcode Command Line Tools on Macs running 10.7.x and higher. See below the jump for more details.

The script will perform different tasks, depending on which version of OS X it’s being run on.

On OS X 10.9.x and 10.10.x:

  1. Creates a placeholder file in /tmp. This file’s existence is checked by the softwareupdate tool before allowing the installation of the Xcode command line tools.
  2. Runs the softwareupdate tool and checks for the latest version of the Xcode command line tools for the OS in question.
  3. Uses the softwareupdate tool to install the latest version of the Xcode command line tools for the OS in question.
  4. Removes the placeholder file stored in /tmp.

On Mac OS X 10.7.x and 10.8.x:

  1. Uses curl to download a disk image containing the specified Xcode Command Line Tools installer from Apple’s web site.
  2. Renames the downloaded disk image to cltools.dmg.
  3. Mounts the disk image silently in /tmp. Disk image will not be visible to any logged-in user.
  4. Installs the Xcode Command Line Tools using the installer package stored on the disk image
  5. After installation, unmounts the disk image and removes it from the Mac in question.

Note: This script should not be used as part of a payload-free installer package. On 10.9.x and 10.10.x, the softwareupdate tool will not work properly when called from within an installer package.

The script is available below. It’s also available from my Github repo from the following link:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/install_xcode_command_line_tools



Viewing all articles
Browse latest Browse all 764

Trending Articles