Created
November 15, 2021 21:03
-
-
Save steeve/4e5d37ca9a07d4a796b909a6c9ae6156 to your computer and use it in GitHub Desktop.
Xcode 12.5 + Monterey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eux | |
readonly xcode12="/Applications/Xcode-12.5.0.app" | |
readonly xcode13="/Applications/Xcode-13.1.0.app" | |
# Backup Xcode 12 Info.plist | |
cp "${xcode12}/Contents/Info.plist" "${xcode12}/Contents/Info.plist.bak" | |
# Extract Xcode 13's CFBundleVersion | |
readonly xcode13_version=$(/usr/bin/plutil -extract "CFBundleVersion" raw "${xcode13}/Contents/Info.plist") | |
# Put Xcode 13's CFBundleVersion inside Xcode 12's Info.plist | |
/usr/bin/plutil -replace "CFBundleVersion" -string "${xcode13_version}" "${xcode12}/Contents/Info.plist" | |
# Open Xcode 12 so that the bundle is registered | |
open "${xcode12}" | |
# Sleep 5 seconds to let it start, kill it, and restore the original Info.plist | |
sleep 5 | |
pkill -f Xcode | |
mv "${xcode12}/Contents/Info.plist.bak" "${xcode12}/Contents/Info.plist" | |
# Reopen it in case lsd needs to refresh the CFBundleVersion | |
open "${xcode12}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another option for forcing registrations / LSD updates, you can also explicitly ask LS to register it instead of calling
open
on the bundle. So I think you should be able to replaceopen "${xcode12}"
with: