简体   繁体   中英

How to use Xcode 13 in macOS Ventura?

I have installed macOS Ventura – the latest version of macOS – and I would like to have a stable version of Xcode (eg 13.4.1) running. However, it says "The version of Xcode installed on this Mac is not compatible with macOS Ventura."

Is there any way to run Xcode on Ventura?

错误弹出窗口的屏幕截图

Xcode 14 is required by macOS Ventura. But if, in case you want to use your old version of Xcode (eg Xcode 13), you can launch it directly from the finder or from the terminal.

To open in finder navigate to:

Applications Folder > Find Xcode App > Right click on the app and click on Show Package Contents > Open Contents > Open MacOS > and launch Xcode .

Or

Run the following command in the terminal:

open /Applications/Xcode.app/Contents/MacOS/Xcode .

Single-run script to fix the problem

As this problem in principle is the same problem as last year, when we wanted to run Xcode 12 on macOS Monterey, it is worth to check last year's question on the same problem . There, I found this great answer in which a script is proposed that only needs to be run once to fix the problem (allowing a regular opening of Xcode 13, eg via double click). The script works by changing the build version of the old Xcode 13 to the build version of the new Xcode 14, thereby tricking the OS.

Before running the script, you need to change the OLD_XCODE and NEW_XCODE variables to the correct path .

#!/bin/sh

set -euo pipefail

# Set the paths to your Old/New Xcodes
OLD_XCODE="/Applications/Xcode-13.4.1.app"
NEW_XCODE="/Applications/Xcode-14.1.0.app" # To get build number

# Get New Xcode build number
OLD_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${OLD_XCODE}/Contents/Info.plist)
NEW_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${NEW_XCODE}/Contents/Info.plist)

echo The Old Xcode build version is $OLD_XCODE_BUILD
echo The New Xcode build version is $NEW_XCODE_BUILD

# Change Old Xcode build version to New Xcode
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${NEW_XCODE_BUILD}" ${OLD_XCODE}/Contents/Info.plist

# Open Old Xcode (system will check build version and cache it)
open $OLD_XCODE

# Revert Old's Xcode's build version
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${OLD_XCODE_BUILD}" ${OLD_XCODE}/Contents/Info.plist

For my future self, when I prematurely upgrade my macOS to the latest version.

Since I'm using Xcode just for a building purposes for my Flutter app and I don't really care about Xcode UI, all I needed to do is:

  1. Download the desired xcode version app from https://xcodereleases.com
  2. Unzip the app and rename it to Xcode-<version>.app
  3. Move it to /Applications directory
  4. Run xcode-select command: xcode-select -s /Applications/Xcode-<version>.app
  5. Confirm that the correct Xcode version is selected with xcode-select -p
  6. That's it.

That way I can have multiple Xcode app versions and I can quickly switch between them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM