← Back

How to install Swiftly and Swift toolchain in ArchLinux

2026-04-22

Get Swift Toolchain

Swiftly is the package manager which hosted and maintained by Apple, the official maintainer of Swift. The official script to install swiftly is avaliable:

# fish
curl -O https://download.swift.org/swiftly/linux/swiftly-(uname -m).tar.gz && \
tar zxf swiftly-(uname -m).tar.gz && \
./swiftly init --quiet-shell-followup && \
set -q SWIFTLY_HOME_DIR && \
source "$SWIFTLY_HOME_DIR/env.fish" || source ~/.local/share/swiftly/env.fish

or in bash:

# bash
curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \
tar zxf swiftly-$(uname -m).tar.gz && \
./swiftly init --quiet-shell-followup && \
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh" && \
hash -r

and according the PKGBUILD of AUR ( [aur:ashleyis and aur:susurri, Dec 4, 2015 -- Apr 18, 2026] and [aur:speedorama, Sep 20, 2023 -- Jan 1, 2026] ), distrobution ubi9 (RHEL 9) is suitable, so if swiftly ask you to choose a distrobution:

Please select the platform to use for toolchain downloads:

0) Cancel
1) Ubuntu 24.04
2) Ubuntu 22.04
3) Ubuntu 20.04
4) Ubuntu 18.04
5) Fedora Linux 39
6) RHEL 9
7) Amazon Linux 2
8) Debian GNU/Linux 12

select 6.

Check Missing Libraries

There’s a script to help you to find the missing libraries:

#!/usr/bin/env bash

tc="$(swiftly use --print-location)"

find "$tc" -type f \( -perm -111 -o -name '*.so*' \) -print0 |
    while IFS= read -r -d '' f; do
        file "$f" | grep -q ELF || continue
        ldd "$f" 2>/dev/null | awk -v bin="$f" '/not found/ {print bin " -> " $1}'
    done | sort -u

old python versions is avaliable in AUR.

There’re three libraries need to modified manually: libncurses.so.6, libpanel.so.6 and libform.so.6. In Arch Linux, these libraries is no longer available for safety reasons, you should replace them with modern version. But, I want to say: all commands are symbolic links to swiftly, and it transmit the requests to the real exe in toolchain, include the LLVM toolchain of swift itself. So, patchelf can not be used because swiftly is static linked. A proper way is

mkdir -p ~/.local/lib
ln -sf /usr/lib/libncursesw.so.6 ~/.local/lib/libncurses.so.6
ln -sf /usr/lib/libpanelw.so.6 ~/.local/lib/libpanel.so.6
ln -sf /usr/lib/libformw.so.6 ~/.local/lib/libform.so.6

and add this code in your rc file to update environment variable:

# ~/.bashrc
export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH

or

# ~/.config/fish/config.fish
set -gx LD_LIBRARY_PATH $HOME/.local/lib LD_LIBRARY_PATH

then restart your shell.

Manuly Install Toolchain

You need to install Python 3.9 (for RHEL 9) or Python 3.11 (for Debian GNU/Linux 12, and due to the reasons in version of libncurses, the REPL cannot be used), check missing libraries and do the compatiable approach above first. Then launch swiftly, run

swiftly install latest

after installation run

swiftly link

Installation Verification

Here I offer a fish script to check your installation:

function swift-fast-check
    echo -e "\033[35mInitializing...\033[0m" &&
    rm -rf /tmp/swift-test/ &&
    curdir=(pwd) {
        echo -e "\033[35mSwiftly:\033[0m" &&
        swiftly --version &&
        var=(swiftly use --print-location) {
            echo -e "\033[35mswift:\033[0m" &&
            $var/usr/bin/swift --version &&
            echo -e "\033[35mswiftc:\033[0m" &&
            $var/usr/bin/swiftc --version
        } && {
            echo -e "\033[35mBuilding:\033[0m" &&
            mkdir -p /tmp/swift-test &&
            cd /tmp/swift-test &&
            swift package init --type executable &&
            swift build
        } && {
            echo -e "\033[35mAre you want to enter REPL?\033[0m" &&
            read -l -P "  [Y/n]: " confirm
                switch $confirm
                    case Y ycle
                        swift repl
                    case '*'
                end
        } &&
        cd $curdir
    }
end

add to your ~/.config/fish/config.fish and run swift-fast-check to check your installation.


 References 

  1. Apple. Swift. 2026. Available at https://www.swift.org/ .
  2. Apple. Swiftly. 2022. Available at https://www.swift.org/swiftly/documentation/swiftlydocs/ .
  3. aur:ashleyis, aur:susurri. AUR: swift-bin 6.3.1-1. Dec 4, 2015 -- Apr 18, 2026. Available at https://aur.archlinux.org/packages/swift-bin .
  4. aur:speedorama. AUR: swiftly-bin 1.1.1-4. Sep 20, 2023 -- Jan 1, 2026. Available at https://aur.archlinux.org/packages/swiftly-bin .