Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Created August 6, 2015 20:50
Show Gist options
  • Select an option

  • Save cuibonobo/aaef413908838eef7344 to your computer and use it in GitHub Desktop.

Select an option

Save cuibonobo/aaef413908838eef7344 to your computer and use it in GitHub Desktop.
Install Xcode Command Line Tools directly on the Terminal
#!/bin/sh
OSX_VERS=$(sw_vers -productVersion | awk -F "." '{print $2}')
TOOLS=clitools.dmg
if [ ! -f "$TOOLS" ]; then
DMGURL=http://some-url-here.com/because/apple/expires/links/automatically.dmg
curl "$DMGURL" -o "$TOOLS"
fi
TMPMOUNT=`/usr/bin/mktemp -d /tmp/clitools.XXXX`
hdiutil attach "$TOOLS" -mountpoint "$TMPMOUNT"
installer -pkg "$(find $TMPMOUNT -name '*.mpkg')" -target /
hdiutil detach "$TMPMOUNT"
rm -rf "$TMPMOUNT"
rm "$TOOLS"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment