#!/bin/bash set -euo pipefail EXPECTED_XCODE_VERSION=${EXPECTED_XCODE_VERSION:-13.4.1} printf "checking for xcodebuild... " command -v xcodebuild || { echo "not found" exit 1 } printf "checking for Xcode version... " __XCODEVERSION_REAL=$(xcodebuild -version | grep ^Xcode | awk '{print $2}') echo $__XCODEVERSION_REAL [[ "$EXPECTED_XCODE_VERSION" = "$__XCODEVERSION_REAL" ]] || { echo "fatal: Xcode version must be $EXPECTED_XCODE_VERSION instead of $__XCODEVERSION_REAL" exit 1 }