Created
February 17, 2020 21:07
-
-
Save ardeidae/71a1e2e1dbe04fb19320710022b98ef3 to your computer and use it in GitHub Desktop.
headless install of xcode command line tools
This file contains 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 | |
# headless install of xcode command line tools | |
if ! xcode-select -p &> /dev/null; then | |
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress; | |
CLTX=$(softwareupdate --list | \ | |
grep "\*.*Command Line Tools" | \ | |
tail -n 1 | \ | |
awk -F"Label: " '{print $2}' \ | |
) | |
softwareupdate --verbose --install "$CLTX" | |
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment