Skip to content

Instantly share code, notes, and snippets.

@dymx101
Created February 16, 2023 06:14
Show Gist options
  • Save dymx101/3b65e984be709e8aef43d1cea73ac913 to your computer and use it in GitHub Desktop.
Save dymx101/3b65e984be709e8aef43d1cea73ac913 to your computer and use it in GitHub Desktop.
Use Xcode 13.1 on macOS Ventura
Step 1: sudo xcode-select -s /Applications/Xcode-13.1.0.app
Step 2: open /Applications/Xcode-13.1.0.app/Contents/MacOS/Xcode
Extra Step (If step 2 not working, run the script below, then do step 2 again).
```
#!/bin/bash
set -eux
readonly xcode13="/Applications/Xcode-13.1.0.app"
readonly xcode14="/Applications/Xcode-14.1.0.app"
# Backup Xcode 13 Info.plist
cp "${xcode13}/Contents/Info.plist" "${xcode13}/Contents/Info.plist.bak"
# Extract Xcode 14's CFBundleVersion
readonly xcode14_version=$(/usr/bin/plutil -extract "CFBundleVersion" raw "${xcode14}/Contents/Info.plist")
# Put Xcode 14's CFBundleVersion inside Xcode 13's Info.plist
/usr/bin/plutil -replace "CFBundleVersion" -string "${xcode14_version}" "${xcode13}/Contents/Info.plist"
# Open Xcode 13 so that the bundle is registered
open "${xcode13}"
# Sleep 5 seconds to let it start, kill it, and restore the original Info.plist
sleep 5
pkill -f Xcode
mv "${xcode13}/Contents/Info.plist.bak" "${xcode13}/Contents/Info.plist"
# Reopen it in case lsd needs to refresh the CFBundleVersion
open "${xcode13}"
```