Created
January 27, 2018 07:58
-
-
Save lucascantor/15a98823f81d4d8fee2f15fb317c8cd5 to your computer and use it in GitHub Desktop.
Install Xcode Command Line Tools from the command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# create file to prompt 'softwareupdate' utility to see command line tools as available | |
/usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
# check for command line tools in available software updates | |
toInstall=softwareupdate -l | grep -B 1 -E "Command Line (Developer|Tools)" | awk -F"*" '/^ +\\*/ {print $2}' | sed 's/^ *//' | tail -n1 | |
# install this specific software update | |
/usr/sbin/softwareupdate -i "$toInstall" | |
# remove temporary file | |
/bin/rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
# configure command line tools installation | |
/usr/bin/xcode-select --switch /Library/Developer/CommandLineTools | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment