Hello all,
I'm trying to use swift 6.0-dev toolchain on macOS 12 Monterey. I have used the package installer provided on swift.org and followed the instructions to install it. But when I try to use the toolchain it instead uses the default swift 5.7.2 (I have Xcode 14.2 installed with xcode command line tools) I've tried many ways to get it working (I've used swiftenv and tried to set up an environment variable for the toolchain) but couldn't get it to work. I need swift 6.0-dev for swift embedded. Thanks for any help.
I'm running Sonoma 14.4.1 on a Mac M2 Max and have the exact same problem. I can't get anything to work except swift 5.10 even after installing the .pkg version of swift 6.
I've even tried swift 5.10 release and development .pkg installer but it didn't work
Same here, I'm running Sonoma 14.5 with XCode 15.4
Followed the instructions fromhttps://www.swift.org/getting-started/embedded-swift/ and Swift.org - macOS Package Installer
But still using Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
What's the output of xcode-select -p
on your machine?
Output of xcode-select -p is
zsh: command not found: xcode-install
However, when I run xcode-select -p, output is
/Applications/Xcode_15.4.app/Contents/Developer
@Max_Desiatov My bad I was not able to replace <toolchain name> with actual name . Now able to build and run the sample app. Thank you by the way for the quick response
For posterity, if you find that xcode-select -p
points to the command-line tools (CLT) directory and not to the actual Xcode installation directory, the TOOLCHAINS
environment variable will be ignored and development snapshots selected that way will not be picked up. Run
sudo xcode-select \
--switch <your_xcode_installation_path.app>/Contents/Developer
to ensure you don't have the CLT directory selected.
BTW, I recommend installing snapshots on macOS "for current user" only which will put it in ~/Library
, not /Library
. That makes it easier to clean up later and also won't require you to use an admin password during the installation process.
Then to select the toolchain you've just installed, run this command:
export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw \
~/Library/Developer/Toolchains/swift-latest.xctoolchain/Info.plist)
After this, all toolchain invocations like swift
, swiftc
, clang
etc in the current shell will point to that latest snapshot.
Just what I was looking for - thank you @Max_Desiatov !
Out of interest, any idea why having the CLT directory selected means the TOOLCHAINS
environment variable will be ignored?
This looks like a bug to me, which I'd appreciate if someone could file at https://feedbackassistant.apple.com/.
Sounds good - feedback filed
Would you mind also sharing the FB number? Thanks!
ah yep apologies - FB14287186