How to use Xcode 13 in macOS Ventura?
Asked Answered
M

5

36

I have installed macOS Ventura – the latest version of macOS – and I would like to have a stable version of Xcode (e.g. 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?

Screenshot of error popup

Manakin answered 25/10, 2022 at 10:8 Comment(0)
M
72

Xcode 14 is required by macOS Ventura. But if, in case you want to use your old version of Xcode (e.g 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.

Update:

The same procedure can be followed to use Xcode 14 in macOS Sonoma.

Manakin answered 25/10, 2022 at 10:8 Comment(6)
If using command lines you get the error: The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10664 "kLSIncompatibleApplicationVersionErr: The app is incompatible with the current OS" UserInfo={_LSLine=4087, _LSFunction=_LSOpenStuffCallLocal} just kill the command and try again, it should work !Trap
Also, you may need to set the command line tools with xcode-select -s <your_xcode13.x_path> because Xcode > Preferences > Location won't show options to downgrade it in UI.Lynx
Download the older Xcode versions from link and apply the above steps on the XCode zip file in the Downloads folder on mac.Privily
This worked for me but in my case I had installed Ventura to find out that the latest xcode didn't work, downloaded and extracted the 13.4.1 version after having to remove 14 because it didn't work with Visual Studio. So my xcode was extracted in downloads and I was able to open from there. Thanks!Emilemile
Case note: we upgraded the OS on a machine but did not yet put xcode 14 on it. Running the existing xcode 13.4.1 from the UI failed as expected, running from command line showed the IDE, but builds failed in strange ways with no clear information why. So I don't consider this a good answer. Zapping the build number with the scripted approach allowed things to run and build successfully.Exogamy
Xcode 14.3 on macOS Sonoma show popup with agree, when i click on agree in terminal show Xcode[31380:366669] [MT] IDELicenseAgreement: Request for license agreement returned error. Request=<OS_xpc_dictionary: <dictionary: 0x60000334aac0> { count = 2, transaction: 0, voucher = 0x0, contents = "xcodebuild-path" => <string: 0x6000019a28e0> { length = 61, contents = "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" } "auth-key" => <data: 0x600000270e40>: { length = 32 bytes, contents = 0x4a032ccdf47a9f29a3860100000000000000000000000000... } }>, Error=Connection interruptedMagnesium
K
27

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, e. g. 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 absolute 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
Koester answered 19/11, 2022 at 13:34 Comment(1)
I left an answer that is relevant to this, and may be helpful for others who find their xcode-select or other weird icon/path issues break after they try to do further updates. It was too many characters, so I couldn't leave it as a comment.Dance
S
8

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.

Sweven answered 13/1, 2023 at 12:25 Comment(1)
I had to use "sudo" BTW, still, how do I start the selected version? it still shows the current updated version on ventura M1.Hermia
L
4

To continue using Xcode 14 in Sonoma, you can modify the info.plist file under the xcode.app directory and set a larger value for Bundle version, such as 22265. After saving the changes, you will be able to proceed with using Xcode 14.

Lobeline answered 27/9, 2023 at 5:22 Comment(2)
on my mac, it says you're not allowed to edit the plist. How did you get around that?Augustus
chmod 777 info.plistLobeline
D
1

FYI, using fredpi's working solution above has some caveats which I discussed with my coworkers. From nglevin (slightly paraphrased to redact names), this solution may cure some side-effects from using fredpi's solution:

One caveat to raise about this; changing Xcode's root info plist, may corrupt part of macOS's Launch Services database, a legacy API for which is still used by xcode-select (not all modern production macs do, but some developer environments may).

This will make it challenging to use sudo xcode-select -s /path/to/Xcode.app to select a given Xcode; your Launch Services database will be stuck on whatever Xcodes it found before the plist change.

To rebuild the Launch Services database, do this in your Mac's terminal:

sudo lsregister -kill -r -domain local -domain system -domain user

And your next sudo xcode-select -s ... invocation should succeed.

Dance answered 2/1 at 22:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.