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?
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.
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 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:
Download the desired xcode version app from https://xcodereleases.com
Unzip the app and rename it to Xcode-<version>.app
Move it to /Applications directory
Run xcode-select command: xcode-select -s /Applications/Xcode-<version>.app
Confirm that the correct Xcode version is selected with xcode-select -p
That's it.
That way I can have multiple Xcode app versions and I can quickly switch between them.
Related
As soon as I create an Xcode project I can't build and have a bunch of errors (Xcode version 12.4)
Could not build Objective-C module 'SwiftUI'
I figured it out! MY Xcode was using the wrong toolchain version even tho I tried to uninstall Xcode and reinstall it.
Make sure you have selected the correct version, in my case since I was running Xcode 12.4, I had to use version 12.4 for toolchains. It's weird that Xcode did not manually change it since I updated.
To updated version:
Xcode > Preferences > Components > Toolchains > and then select your
version
I recently reformatted my Mac. Today I tried building a swift executable via Terminal to start a server-side swift project. Here are the commands I've used:
swift package init --type executable
swift build
Upon running swift build, I got the following errors:
xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation
xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
I'm running Xcode 8.3.1.
Thanks in advance!
Try fixing the SDK path (yours appears incorrect):
$ xcrun --show-sdk-path --sdk macosx
You might have this result:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Switch the default SDK location by invoking:
$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
If that doesn't work then take a look inside the (normal) SDK path:
$ ls -lat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
You should see the SDK's within that directory; if not you'll need to download them.
Select a version of Xcode which can run the swift build command by running, for instance:
sudo xcode-select -switch /Applications/Xcode-8.3.3.app
Where Xcode-8.3.3 is the name of your Xcode application
I'm running macOS 10.12.3 with Xcode 8.3.
I cannot build any macOS Swift projects with it.
If I create a new Cocoa application Xcode project and set it to use Swift, when I try to compile it, I immediately get the following error in the "check dependencies" phase:
error: There is no SDK with the name or path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk'
I have no idea what's going wrong!
The only clue I have is that earlier I created a symlink with the path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk that pointed to MacOSX.sdk in order to fix an issue where an older build of Qt that required an SDK with that path. However, deleting the symlink has no effect.
I can build Swift projects that targeting other platforms like iOS. Just not macOS.
Help!
try running this command then reopening the project
(Xcode uses xtools in the command line to build its projects)
sudo xcode-select -switch /path/to/file/
(by default the path is)/Applications/Xcode.app/
look at this pic
saw it here yesterday
I am getting this error while building the SwiftJSON framework to the Some Xcode project through Carthage Dependency Manager.
Sivaramaiahs-Mac-mini:GZipDemoApp vsoftMacmini5$ carthage update
--platform iOS
*** Fetching GzipSwift
*** Fetching SwiftyJSON
*** Checking out GzipSwift at "3.1.1"
*** Downloading SwiftyJSON.framework binary at "3.1.3"
*** xcodebuild output can be found in /var/folders/7m/y0r2mdhn0f16zz1nlt34ypzr0000gn/T/carthage-xcodebuild.apLXCc.log
A shell task (/usr/bin/xcrun xcodebuild -project
/Users/vsoftMacmini5/Desktop/GZipDemoApp/Carthage/Checkouts/GzipSwift/Gzip.xcodeproj
CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list)
failed with exit code 72:
xcrun: error: unable to find utility "xcodebuild", not a developer
tool or in PATH
I solved that problem by setting the Command Line Tools in Xcode. Go to:
Xcode > Preferences > Locations
And select the command line tool from the dropdown. If you have only one version of Xcode installed, there should be only one option. If you have several versions of Xcode, then you must choose the one you need.
Update (added image for reference)
The simplest fix is from CLI:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
(this should be path to your Xcode.app)
By the way this can happen even if you have only one version of Xcode . It happens when you instal homebrew before the first Xcode installation (which makes sense because you may want to install Xcode through mas install 497799835 and mas needs homebrew).
Following command worked for me
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
I'm trying to run Kitura project on XCode. I tried to follow instructions on this page ([https://github.com/IBM-Swift/Kitura/wiki/Building-your-Kitura-application-on-XCode]), however I failed with step 3 – run swift build -X. I get this error:
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build (No such file or directory)
Looks like I have latest toolchain installed (see the screenshot below).
I also have both XCode 7.3.1 and XCode 8 beta. What would you suggest to solve that problem?
As Daniel mentioned above, Kitura right now requires use of the June 6 drop of the Swift Development toolchain. This toolchain can only be used with Xcode v7.3.1. The toolchain format changed between Xcode 7.x and newer Xcode 8 beta. When using the Xcode 8 beta with the new June 20 toolchain, there's another step that you need to do before you can run swift build from the command line.
From the command line, enter the following command:
$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer/
This command is necessary to inform Xcode where to find the required binaries and frameworks.
To switch it back, just use the same command but point it at non-beta version of Xcode:
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
Using these commands will eliminate the error <unknown>:0: error: Swift does not support the SDK 'MacOSX10.11.sdk' error: exit(1): that you ran into.
The Xcode 8 beta will be required to be used for all future Swift.org toolchains unless otherwise specified.
As of this writing, Kitura only compiles with the 06-06 Swift Development toolchain so make sure you have that installed.
In addition the wiki was out of date, the generate Xcode project command got renamed to swift package generate-xcodeproj. I updated the wiki to reflect this change.
Try:
export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"