To get up and going on a Mac, you simply need to choose the type of Swift toolchain you want to develop against. You can choose a version from the Download section. Swift on a Mac is included with Xcode, making it really easy to get started. Swift 3 requires you to have macOS 10.11.5 (El Capitan) or later and Xcode 8. Let's walk through the steps together and install Swift 3 on a Mac.
An Xcode toolchain is a special binary with a toolchain extension that includes Xcode and all of the tools and libraries that make up Swift (LLVM, LLDB, REPL, and other tools) all targeted at a specific Swift version. You can think of a toolchain as a bundled development environment that you install and extract onto your system to work with a specific release. When you want to try out a different version, you have to download and install the toolchain that corresponds to the target version.
The Xcode package that you download for a release or developer snapshot should be digitally signed with a developer ID (Developer ID Installer: Swift Open Source (V9AUD2URP3)) of the open source project to protect against malicious code and tampering. The Swift installer should display a lock on the right side of the title bar. When you click the lock, you should see details on the developer signature.
Selecting Toolchains in Xcode 8
Toolchains menu in Xcode
toolchain
.
$ xcrun --toolchain swift
$ xcodebuild --toolchain swift
Once you have your toolchain installed on your Mac, you simply need to launch Xcode and you can begin developing. Since we will spend the majority of the next few chapters tackling new Swift features using Xcode, we are going to shift gears and spend the rest of this chapter discussing Swift on Linux.