4 ms·
I’m pretty sure you need Xcode to compile Swift on macOS.
by yunohn 2y ago
I’m pretty sure you need Xcode to compile Swift on macOS.
- acar_rag 2y agoAbsolutely not, you just need to use swiftc: https://theswiftdev.com/the-swift-compiler-for-beginners/ https://theswiftdev.com/the-swift-compiler-for-beginners/
- robjwells 2y agoYou 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 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/4396 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.
- latexr 2y agoEveryone 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).