I'm running on a 2013 Mac so I can only use up to MacOS Big Sur, therefore I cannot download the latest Xcode, yet I wish to use the latest Swift release (5.6.2 at time of writing) from the terminal.
I went and downloaded the release from Swift.org - Download Swift . After installing, compiling code works with swift build
, but the repl does not. E.g.:
% swift -v
Apple Swift version 5.6.2 (swift-5.6.2-RELEASE)
Target: x86_64-apple-macosx11.0
/Library/Developer/Toolchains/swift-5.6.2-RELEASE.xctoolchain/usr/bin/swift-frontend --version
Apple Swift version 5.6.2 (swift-5.6.2-RELEASE)
Target: x86_64-apple-macosx11.0
/Library/Developer/Toolchains/swift-5.6.2-RELEASE.xctoolchain/usr/bin/swift-help intro
error: help command failed due to signal 6 (use -v to see invocation)
dyld: Library not loaded: @rpath/libArgumentParserToolInfo.dylib
Referenced from: /Library/Developer/Toolchains/swift-5.6.2-RELEASE.xctoolchain/usr/lib/swift/macosx/libArgumentParser.dylib
Reason: image not found
I further attempted the following, as written in the "Installation" section of the provided link above:
% xcrun --toolchain swift-5.6.2-RELEASE
xcrun: error: no utility name specified
% xcodebuild -toolchain swift-5.6.2-RELEASE
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -toolchain swift-5.6.2-RELEASE
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
TOOLCHAINS = swift-5.6.2-RELEASE
xcodebuild: error: The directory /Users/Me/Documents/projects does not contain an Xcode project.
which did not seem to help at all.
It appears that libArgumentParserToolInfo.dylib
which I assume is built from GitHub - apple/swift-argument-parser: Straightforward, type-safe argument parsing for Swift does exist:
% ls /Library/Developer/Toolchains/swift-5.6.2-RELEASE.xctoolchain/usr/lib/swift/macosx/libArgumentParser.dylib
/Library/Developer/Toolchains/swift-5.6.2-RELEASE.xctoolchain/usr/lib/swift/macosx/libArgumentParser.dylib*
I am not positive I understand what Reason: image not found
means then.
Any help in resolving this would be much appreciated