Installing Swift

Unfortunately, the official Swift binaries only work on Ubuntu, and they’re standalone binaries independent of any package manager. Here are steps on getting it to work on various distros/package tools.


The easiest way to get started using Swift is via the Flatpak repo. Make sure you’ve followed the official Flatpak setup instructions.

First, make sure you have the Freedesktop SDK installed:

$ flatpak --user install flathub org.freedesktop.Sdk

Add the Flatpak remote:

$ flatpak --user remote-add swift
# Or, if you prefer to add it manually:
curl -sSL | flatpak --user remote-add --gpg-import=- swift

Then, install the SDK extension and live SDK:

$ flatpak --user install swift org.freedesktop.Sdk.Extension.swift4

In order to run the Swift compiler via the Flatpak, you’ll need to use this command:

$ flatpak run -d swift ...

To shorten this, define an alias:

$ alias swiftpak='flatpak run -d swift'

Now, you can just use swiftpak:

$ swiftpak


You can use the official Swift binaries. If you want to be able to upgrade Swift via apt, then try out the Vapor PPA:

$ eval "$(curl -sL"


curl -L | sudo apt-key add -
echo "deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/vapor.list
sudo apt update
sudo apt install swift


An RPM is available here, though it requires a build from source. The Ubuntu binaries should more-or-less work if you patch them as mentioned in Using the Ubuntu Binaries.

Arch Linux

You can install Swift on Arch Linux using either the AUR swift package or the swift-bin package. (The former builds from source, whereas the latter uses patched versions of the Ubuntu binaries.)


For other distros, see Extra Credit: Swift on Other Distros.

If you’ve gotten Swift working on your favorite distros, feel free to create an issue to mention yours!