Last active
October 11, 2017 19:41
-
-
Save dfreniche/3e72d845a31ce6e7590ff2cf5b790ddb to your computer and use it in GitHub Desktop.
Rather crude script to change between Xcode 8 and Xcode 9 selecting the correct 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 | |
# if 1st param empty... | |
if [ -z "$1" ] | |
then | |
echo "Usage: select-xcode {8|9}" | |
exit | |
fi | |
XCODE8_APP=/Applications/Xcode-8.app | |
XCODE9_APP=/Applications/Xcode.app | |
du -hs ~/Library/Developer/Xcode/DerivedData/ | |
echo "🔥 Deleting derived data..." | |
rm -rf ~/Library/Developer/Xcode/DerivedData/* | |
echo "Closing open Simulators" | |
killall "Simulator" | |
killall "Xcode" | |
echo "Select command line tools" | |
if [ $1 == "8" ] | |
then | |
sudo xcode-select -s $XCODE8_APP/Contents/Developer/ | |
else | |
sudo xcode-select -s $XCODE9_APP/Contents/Developer/ | |
fi | |
echo "💻 Selected Command line tools:" | |
xcode-select --print-path | |
echo "🛠 Opening Xcode" | |
if [ $1 == "8" ] | |
then | |
open $XCODE8_APP | |
else | |
open $XCODE9_APP | |
fi |
True. That's why it's "rather crude" :-D
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe '$HOME/Library/Developer/Xcode/DerivedData/' instead of '/Users/dfreniche/Library/Developer/Xcode/DerivedData/' could make the script for any user.