Skip to content

Instantly share code, notes, and snippets.

@Pranit-Harekar
Last active September 22, 2017 13:46
Show Gist options
  • Save Pranit-Harekar/ab926532943b63c8189a91d704deb5ff to your computer and use it in GitHub Desktop.
Save Pranit-Harekar/ab926532943b63c8189a91d704deb5ff to your computer and use it in GitHub Desktop.
Remote shell script to automatically install XCode CLI tools
#!/bin/sh
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
PROD=$(softwareupdate -l | grep "\*.*Command Line" | head -n 1 | awk -F"*" '{print $2}' | sed -e 's/^ *//' | tr -d '\n')
softwareupdate -i "$PROD" --verbose
rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment