Skip to content
Snippets Groups Projects
xcode-cli-tools.sh 464 B
#!/bin/sh

set -eox pipefail

# create the placeholder file that's checked by CLI updates' .dist code
# in Apple's SUS catalog
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress

# find the CLI Tools update
PROD=$(softwareupdate -l | grep "\*.*Command Line" | tail -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
# install it
softwareupdate -i "$PROD" --verbose

rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress