Download Swift
Latest Development Snapshots
Development Snapshots are prebuilt binaries that are automatically created from mainline development branches. These snapshots are not official releases. They have gone through automated unit testing, but they have not gone through the full testing that is performed for official releases.
Platform | Download | Date |
---|---|---|
Apple Platforms | Xcode Swift 2.2 Snapshot Debugging Symbols | |
Linux | Ubuntu 15.10 Swift 2.2 Snapshot Signature | |
Linux | Ubuntu 14.04 Swift 2.2 Snapshot Signature |
Swift is covered by the Swift License at swift.org/LICENSE.txt.
Apple Platforms
Xcode includes a release of Swift that is supported by Apple. You can try out a version that is still in development by downloading one of the packages above.
Playgrounds are not currently supported for downloadable Swift packages.
To submit to the App Store you must build your app using the version of Swift that comes included within Xcode.
Requirements for Tools
- OS X 10.11 (El Capitan)
- Xcode 7.2 (including prerelease versions)
Supported Target Platforms
- OS X 10.9.0 or later
- iOS 7.0 or later
- watchOS 2.0 or later
- tvOS 9.0 or later
Installation
-
Download the latest package release.
-
Run the package installer, which will install an Xcode toolchain into
/Library/Developer/Toolchains/
.An Xcode toolchain (
.xctoolchain
) includes a copy of the compiler, lldb, and other related tools needed to provide a cohesive development experience for working in a specific version of Swift. -
Quit Xcode if it is already running.
-
Start Xcode with the custom toolchain you downloaded to enable the open source version of Swift:
$ xcrun launch-with-toolchain /Library/Developer/Toolchains/swift-latest.xctoolchain
swift-latest.xctoolchain
is a symlink to your most recently installed toolchain, such asswift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain
. The name of each toolchain indicates the date the toolchain was built from the open sourcemaster
branch (which tracks bleeding-edge development on Swift).Within a running instance of Xcode launched with
launch-with-toolchain
, Xcode uses the downloaded toolchain for building Swift code, debugging, and even code completion and syntax coloring. If you quit Xcode, you must relaunch it withlaunch-with-toolchain
to continue using the downloaded toolchain; otherwise, Xcode uses its default toolchain the next time you launch it. -
To use the Swift tools directly from the command line, add the Swift toolchain to your path as follows:
$ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"
Code Signing on OS X
The OS X .pkg
files are digitally signed
by the developer ID of the Swift open source project
to allow verification that they have not been tampered with.
All binaries in the package are signed as well.
The Swift toolchain installer on OS X
should display a lock icon on the right side of the title bar.
Clicking the lock brings up detailed information about the signature.
The signature should be produced by
Developer ID Installer: Swift Open Source (V9AUD2URP3)
.
If the lock is not displayed or the signature is not produced by the Swift open source developer ID, do not proceed with the installation. Instead, quit the installer and please email swift-infrastructure@swift.org with as much detail as possible, so that we can investigate the problem.
Linux
Packages for Linux are tar archives including a copy of the Swift compiler, lldb, and related tools.
You can install them anywhere as long as the extracted tools are in your PATH
.
Note that nothing prevents Swift from being ported to other Linux distributions beyond the ones mentioned below. These are only the distributions where these binaries have been built and tested.
Requirements
- Ubuntu 14.04 or 15.10 (64-bit)
Supported Target Platforms
- Ubuntu 14.04 or 15.10 (64-bit)
Installation
-
Download the latest binary release above.
The
swift-<VERSION>-<PLATFORM>.tar.gz
file is the toolchain itself. The.sig
file is the digital signature. -
If you are downloading Swift packages for the first time, import the PGP keys into your keyring:
$ gpg --keyserver hkp://pool.sks-keyservers.net \ --recv-keys \ '7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD' \ '1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F'
or:
$ wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
Skip this step if you have imported the keys in the past.
-
Verify the PGP signature.
The
.tar.gz
archives for Linux are signed using GnuPG with one of the keys of the Swift open source project. Everyone is strongly encouraged to verify the signatures before using the software.First, refresh the keys to download new key revocation certificates, if any are available:
$ gpg --keyserver hkp://pool.sks-keyservers.net --refresh-keys Swift
Then, use the signature file to verify that the archive is intact:
$ gpg --verify swift-<VERSION>-<PLATFORM>.tar.gz.sig ... gpg: Good signature from "Swift Automatic Signing Key #1 <swift-infrastructure@swift.org>"
If
gpg
fails to verify because you don’t have the public key (gpg: Can't check signature: No public key
), please follow the instructions in Active Signing Keys below to import the keys into your keyring.You might see a warning:
gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner.
This warning means that there is no path in the Web of Trust between this key and you. The warning is harmless as long as you have followed the steps above to retrieve the key from a trusted source.
If
gpg
fails to verify and reports “BAD signature”, do not use the downloaded toolchain. Instead, please email swift-infrastructure@swift.org with as much detail as possible, so that we can investigate the problem. -
Extract the archive with the following command:
$ tar xzf swift-<VERSION>-<PLATFORM>.tar.gz
This creates a
usr/
directory in the location of the archive. -
Add the Swift toolchain to your path as follows:
$ export PATH=/path/to/usr/bin:"${PATH}"
You can now execute the
swift
command to run the REPL or build Swift projects. -
Install clang.
swiftc
currently depends onclang++
, and will not correctly compile programs without it.$ sudo apt-get install clang
Active Signing Keys
The Swift project uses one set of keys for snapshot builds, and separate keys for every official release. We are using 4096-bit RSA keys.
The following keys are being used to sign toolchain packages:
-
Swift Automatic Signing Key #1 <swift-infrastructure@swift.org>
- Download
- https://swift.org/keys/automatic-signing-key-1.asc
- Fingerprint
7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD
- Long ID
D441C977412B37AD
To import the key, run:
$ gpg --keyserver hkp://pool.sks-keyservers.net \ --recv-keys \ '7463 A81A 4B2E EA1B 551F FBCF D441 C977 412B 37AD'
Or:
$ wget -q -O - https://swift.org/keys/automatic-signing-key-1.asc | gpg --import -
-
Swift 2.2 Release Signing Key <swift-infrastructure@swift.org>
- Download
- https://swift.org/keys/release-key-swift-2.2.asc
- Fingerprint
1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F
- Long ID
9F597F4D21A56D5F
To import the key, run:
$ gpg --keyserver hkp://pool.sks-keyservers.net \ --recv-keys \ '1BE1 E29A 084C B305 F397 D62A 9F59 7F4D 21A5 6D5F'
Or:
$ wget -q -O - https://swift.org/keys/release-key-swift-2.2.asc | gpg --import -