Skip to content

Instantly share code, notes, and snippets.

@krystofwoldrich
Created September 19, 2022 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krystofwoldrich/d9c528c0a22de510651beb91e452b3fe to your computer and use it in GitHub Desktop.
Save krystofwoldrich/d9c528c0a22de510651beb91e452b3fe to your computer and use it in GitHub Desktop.
Get xcode version in bash
#!/usr/bin/env bash
set -euo pipefail
# Matches the version number from the output of xcodebuild -version
# Example: 13.4.1
xcodeBin=/usr/bin/xcodebuild
xcodeVersionOutput=$($xcodeBin -version)
xcodeVersion=$(echo "$xcodeVersionOutput" | perl -pe '($_)=/([0-9]+([.][0-9]+)+)/')
echo "$xcodeVersion"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment