diff --git a/install.sh b/install.sh index 47c2774..152a0be 100755 --- a/install.sh +++ b/install.sh @@ -199,13 +199,6 @@ fi # Check if the Xcode path is correct if [ "$(xcode-select -p)" != "/Applications/Xcode.app/Contents/Developer" ]; then - echo -e "\033[34m>Changing the Xcode path...\033[0m" - sudo xcode-select -s "/Applications/Xcode.app/Contents/Developer" - XCODE_VERSION=$(xcodebuild -version | grep '^Xcode\s' | sed -E 's/^Xcode[[:space:]]+([0-9\.]+)/\1/') - ACCEPTED_LICENSE_VERSION=$(defaults read /Library/Preferences/com.apple.dt.Xcode 2> /dev/null | grep IDEXcodeVersionForAgreedToGMLicense | cut -d '"' -f 2) - sudo xcodebuild -license accept - echo $XCODE_VERSION - echo $ACCEPTED_LICENSE_VERSION # Check if the Xcode license has been accepted if [ "$XCODE_VERSION" != "$ACCEPTED_LICENSE_VERSION" ]; then echo -e "\033[33m⚠️ WARNING: Xcode license needs to be accepted. Please follow the prompts to accept the license.\033[0m" @@ -216,6 +209,15 @@ if [ "$(xcode-select -p)" != "/Applications/Xcode.app/Contents/Developer" ]; the exit 1 fi fi + echo -e "\033[34m> Changing the Xcode path...\033[0m" + echo -e "\033[34m>=========\033[0m" + sudo xcode-select -s "/Applications/Xcode.app/Contents/Developer" + XCODE_VERSION=$(xcodebuild -version | grep '^Xcode\s' | sed -E 's/^Xcode[[:space:]]+([0-9\.]+)/\1/') + ACCEPTED_LICENSE_VERSION=$(defaults read /Library/Preferences/com.apple.dt.Xcode 2> /dev/null | grep IDEXcodeVersionForAgreedToGMLicense | cut -d '"' -f 2) + echo -e "\033[34m>=========\033[0m" + sudo xcodebuild -license accept + echo -e "\033[34m>$XCODE_VERSION\033[0m" + echo -e "\033[34m>$ACCEPTED_LICENSE_VERSION\033[0m" fi # Check Brew installation