Linux Installation via Tarball
Installation via Tarball
1. Install required dependencies:
Amazon Linux 2
CentOS 7
Debian 12
Fedora 39
Red Hat UBI 9
Ubuntu 24.04
Ubuntu 23.10
Ubuntu 22.04
Ubuntu 20.04
Ubuntu 18.04
2. Download the latest binary release (5.10.1).
The swift-<VERSION>-<PLATFORM>.tar.gz
file is the toolchain itself.
The .sig
file is the digital signature.
3. Import and verify the PGP signature:
Skip this step if you have imported the keys in the past. This does not apply to verify.
Import PGP keys details
$ gpg --keyserver hkp://keyserver.ubuntu.com \
--recv-keys \
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561'\
'E813 C892 820A 6FA1 3755 B268 F167 DF1A CF9C E069'
or:
$ wget -q -O - https://swift.org/keys/all-keys.asc | \
gpg --import -
Verify the PGP signature
If gpg
fails to verify and reports “BAD signature”,
do not use the downloaded toolchain.
Instead, please email [email protected]
with as much detail as possible,
so that we can investigate the problem.
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://keyserver.ubuntu.com --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 #4 <[email protected]>"
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.
4. 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.
5. 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.