Re:Swift is a more convenient Rust
by yunohn on Friday September 06, 2024 @06:14AM
(#41464665)
I’m pretty sure you need Xcode to compile Swift on macOS.
[ Parent
| on HN ]
You can install a Swift toolchain on macOS without Xcode, but Xcode is the “blessed” route and listed first on the swift.org getting started instructions.
https://www.swift.org/install/macos
However, it can be a bumpy ride. For example: “swift test” (via the CLI) doesn’t work if Xcode is not installed. https://github.com/swiftlang/swift-package-manager/issues/43...
I would just emphasise that the OP was about _convenience_ and Swift-without-Xcode on macOS is not smooth sailing.
Everyone who has installed Homebrew has the official CLI Developer Tools (Homebrew installs them for you), and everyone who has those has a way to compile Swift.
Even if you don’t have Homebrew, the first time you try to run `swift` in a Terminal you’ll get a GUI prompt which lets you install the Developer Tools in two clicks.
Or you can run `xcode-select --install` (comes preinstalled, no Xcode needed).
Absolutely not, you just need to use swiftc: https://theswiftdev.com/the-swift-compiler-for-beginners/