Skip to content

Instantly share code, notes, and snippets.

@cisoun
Created August 29, 2018 13:31
Show Gist options
  • Save cisoun/6a64698192eb659c14371d73b751b83a to your computer and use it in GitHub Desktop.
Save cisoun/6a64698192eb659c14371d73b751b83a to your computer and use it in GitHub Desktop.
Switch between stable and beta version of Xcode in the same folder
# Switch between stable and beta version of Xcode in the same folder.
# Useful when you need to work with Xcode beta to try the latest APIs
# and Xcode stable for production on the same machine.
# Folder where Xcode resides.
FOLDER="/Applications"
# Names of the different versions of Xcode.
APP="$FOLDER/Xcode.app/"
APP_BETA="$FOLDER/Xcode-beta.app/"
APP_STABLE="$FOLDER/Xcode-stable.app/"
# Output stuff.
COLOR="\033[32m"
CURRENT="stable"
# Switch both versions of Xcode.
if [ -d $APP_STABLE ]; then
mv $APP $APP_BETA
mv $APP_STABLE $APP
else
mv $APP $APP_STABLE
mv $APP_BETA $APP
COLOR="\033[33m"
CURRENT="beta"
fi
echo "Switched Xcode to $COLOR$CURRENT\033[0m."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment