How to Install Swift on Debian 13 and 12

Last updated Friday, May 22, 2026 10:21 am Joshua James 10 min read

Swift on Debian is now a package-source decision: Debian 13 ships a system-managed compiler, while Debian 12 developers still need Swift.org’s toolchain paths for current releases. To install Swift on Debian, choose the APT package for the lowest-maintenance Debian 13 workflow, Swiftly for version switching on Debian 12, or the official Debian 12 tarball when you want a standalone upstream toolchain.

Each method installs the Swift compiler and Swift Package Manager; the Debian package also exposes tools such as SourceKit-LSP and Swift LLDB through Debian-owned paths. Current Swift.org downloads are newer than Debian 13’s packaged Swift 6.0.x branch, so the method choice mainly comes down to update ownership and whether you need the latest Swift release.

Install Swift on Debian Linux

Debian 13 provides Swift through its standard repositories. Debian 12 users can choose between Swiftly and a manual tarball, and the same Debian 12 tarball can run on Debian 13 when you want the latest upstream release instead of the packaged branch.

MethodSource or ChannelCurrent BranchUpdate OwnerBest For
APTDebian 13 stable repository6.0.xAPT package upgradesDebian 13 systems that prefer Debian-managed packages
SwiftlySwift.org Swiftly managerLatest Swift.org stable releaseswiftly updateDebian 12 systems that need version switching or current Swift releases
TarballSwift.org Debian 12 tarballLatest Swift.org stable releaseupdate-swift helperDebian 12 or 13 systems that need a standalone toolchain under /opt

Swiftly 1.1.1 recognizes Debian 12 but not Debian 13 or Debian 11. The Debian 12 tarball requires glibc 2.34 or later; Debian 12 and 13 meet that requirement, while Debian 11 ships glibc 2.31 and cannot run the current prebuilt toolchain.

Update Debian Before Installing Swift

Refresh the package index and apply any pending upgrades to avoid dependency conflicts during installation.

sudo apt update && sudo apt upgrade

The package and /opt commands use sudo because they change system-owned files. If your account is not configured for administrative commands yet, add your user to sudoers on Debian before continuing.

Install Swift via APT on Debian 13

Debian 13 (Trixie) includes the swiftlang package, which bundles the Swift compiler, package manager, LLDB debugger, and SourceKit-LSP.

sudo apt install swiftlang

Verify the installed version.

swift --version
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-pc-linux-gnu

Install Swift via Swiftly on Debian 12

Swiftly is Apple’s official toolchain manager for Swift on Linux. It downloads prebuilt toolchains directly from Swift.org, so no APT repository, keyring, or source file is added to Debian. Swiftly also manages version switching, toolchain updates, and its own self-update command.

Install the development libraries and tools the Swift toolchain requires, including HTTPS certificates, GPG for signature checks, a C compiler, Git, and headers for core system libraries.

sudo apt install ca-certificates curl gpg tar binutils gcc git pkg-config uuid-dev libcurl4-openssl-dev libedit-dev libicu-dev libncurses-dev libpython3-dev libsqlite3-dev libxml2-dev tzdata

Download the current Swiftly archive and its signature. The $(uname -m) expression selects the matching Linux archive for your CPU architecture, such as x86_64 or aarch64.

curl -fsSLO "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz"
curl -fsSLO "https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz.sig"

Verify the archive with Swift’s signing keys in a temporary GPG home so your normal keyring is not changed.

SWIFT_GPG_HOME=$(mktemp -d)
export GNUPGHOME="$SWIFT_GPG_HOME"
curl -fsSL https://www.swift.org/keys/all-keys.asc | gpg --import -
gpg --verify "swiftly-$(uname -m).tar.gz.sig" "swiftly-$(uname -m).tar.gz"

A successful check reports a good signature from a Swift automatic signing key. After verification, remove the temporary GPG home and extract Swiftly.

rm -rf "$SWIFT_GPG_HOME"
unset GNUPGHOME SWIFT_GPG_HOME
tar -zxf "swiftly-$(uname -m).tar.gz"

Run the Swiftly initializer. It installs the swiftly binary under your user profile, configures your shell environment, and downloads the latest stable Swift toolchain.

./swiftly init --quiet-shell-followup

The swiftly init command downloads the latest stable Swift toolchain, which is roughly 1 GB. The download and extraction can take several minutes depending on your connection and storage speed.

Swiftly adds a sourcing line to ~/.profile that loads automatically on future logins. Apply the changes to your current session by sourcing the environment file and resetting the shell’s command cache.

. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
hash -r

Verify the installed Swift version.

swift --version
Swift version 6.3.2 (swift-6.3.2-RELEASE)
Target: x86_64-unknown-linux-gnu

You can also clean up the downloaded archive and extracted binary from your home directory now that Swiftly is installed.

rm -f ~/swiftly ~/swiftly-*.tar.gz ~/swiftly-*.tar.gz.sig

Install Swift via Tarball on Debian 12 or 13

Apple publishes prebuilt Swift tarballs for Debian 12 on Swift.org. The Debian 12 tarball also runs on Debian 13 because Trixie ships a newer glibc than the toolchain requires. This method stores each version in its own directory under /opt and uses a symlink so your PATH never needs to change when you upgrade or switch versions.

Install the runtime libraries, development headers, download tools, and signature-verification tools that the Swift tarball workflow needs. The command tracks Swift.org’s Debian 12 library and header requirements, uses Debian’s binutils package for linker tools, and adds local utilities for HTTPS downloads and PGP checks.

sudo apt install ca-certificates curl gpg tar binutils gcc git pkg-config uuid-dev libcurl4-openssl-dev libedit-dev libicu-dev libncurses-dev libpython3-dev libsqlite3-dev libxml2-dev tzdata

The official Swift tarball requires glibc 2.34 or later. Debian 11 (Bullseye) ships glibc 2.31 and cannot run the current prebuilt binaries. Upgrade to Debian 12 or 13 before using this method.

Resolve the latest stable Swift tag and store it in a shell variable. Swift 6.3.2 is current on Swift.org, and using Git tags avoids the stale releases/latest response that can lag behind the newest Swift.org tarball.

SWIFT_VERSION=$(git ls-remote --tags https://github.com/swiftlang/swift.git 'refs/tags/swift-*-RELEASE' \
  | sed -E 's|.*refs/tags/swift-([0-9]+\.[0-9]+(\.[0-9]+)?)-RELEASE$|\1|; t; d' \
  | sort -V \
  | tail -n 1)
printf 'Latest stable Swift: %s\n' "$SWIFT_VERSION"

If the command prints an empty version, stop and check the Swift.org tarball page before continuing. Then download the Debian 12 tarball and its PGP signature using the detected version.

SWIFT_TARBALL="swift-${SWIFT_VERSION}-RELEASE-debian12.tar.gz"
SWIFT_BASE_URL="https://download.swift.org/swift-${SWIFT_VERSION}-release/debian12/swift-${SWIFT_VERSION}-RELEASE"
curl -fsI "${SWIFT_BASE_URL}/${SWIFT_TARBALL}" >/dev/null
curl -fsSLO "${SWIFT_BASE_URL}/${SWIFT_TARBALL}"
curl -fsSLO "${SWIFT_BASE_URL}/${SWIFT_TARBALL}.sig"

Import Swift’s PGP signing keys into a temporary keyring and verify the download. This keeps the signature check scoped to the current terminal session instead of modifying your normal GPG keyring.

SWIFT_GPG_HOME=$(mktemp -d)
export GNUPGHOME="$SWIFT_GPG_HOME"
curl -fsSL https://www.swift.org/keys/all-keys.asc | gpg --import -
gpg --verify "${SWIFT_TARBALL}.sig" "$SWIFT_TARBALL"

Look for a good signature from a Swift automatic signing key. A trust warning about the key not being certified is normal when you use a temporary keyring; a bad signature means you should delete the download and stop.

Remove the temporary keyring, then extract the tarball into a versioned directory under /opt. The --strip-components=1 flag removes the top-level directory from the archive so the contents land directly inside the target path.

rm -rf "$SWIFT_GPG_HOME"
unset GNUPGHOME SWIFT_GPG_HOME
sudo mkdir -p "/opt/swift-${SWIFT_VERSION}"
sudo tar xzf "$SWIFT_TARBALL" -C "/opt/swift-${SWIFT_VERSION}" --strip-components=1
test -x "/opt/swift-${SWIFT_VERSION}/usr/bin/swift"

Create a symlink at /opt/swift that points to the versioned directory. The guard refuses to replace a real directory at that path, while still allowing normal symlink rotation between Swift versions.

if [ -e /opt/swift ] && [ ! -L /opt/swift ]; then
  printf '/opt/swift exists and is not a symlink. Move it before continuing.\n' >&2
else
  sudo ln -sfn "/opt/swift-${SWIFT_VERSION}" /opt/swift
fi

Add Swift to PATH on Debian

Add /opt/swift/usr/bin to PATH so the shell can find the tarball toolchain. Pick the option that matches your shell and install scope.

Option A – Single-user, Bash (default Debian shell): add the PATH export to ~/.bashrc. The guard prevents duplicate lines if you rerun the command later.

SWIFT_PATH_LINE='export PATH=/opt/swift/usr/bin:"$PATH"'
touch ~/.bashrc
grep -qxF "$SWIFT_PATH_LINE" ~/.bashrc || printf '%s\n' "$SWIFT_PATH_LINE" >> ~/.bashrc
. ~/.bashrc
hash -r

Option B – Single-user, Zsh: if you have switched your default shell to Zsh, add the export to ~/.zshrc instead.

SWIFT_PATH_LINE='export PATH=/opt/swift/usr/bin:"$PATH"'
touch ~/.zshrc
grep -qxF "$SWIFT_PATH_LINE" ~/.zshrc || printf '%s\n' "$SWIFT_PATH_LINE" >> ~/.zshrc
. ~/.zshrc
hash -r

Option C – System-wide, all users: create a drop-in script in /etc/profile.d/. Every login shell on the system will pick this up automatically.

printf '%s\n' 'export PATH=/opt/swift/usr/bin:"$PATH"' | sudo tee /etc/profile.d/swift.sh >/dev/null
. /etc/profile.d/swift.sh
hash -r

The tee command writes to a root-owned file because normal redirection (>) does not inherit sudo privileges. The dot command loads the new PATH into your current session so you do not need to log out.

Verify the installed version.

swift --version
Swift version 6.3.2 (swift-6.3.2-RELEASE)
Target: x86_64-unknown-linux-gnu

Confirm the shell is resolving the binary from the correct path.

command -v swift
/opt/swift/usr/bin/swift

Clean up the downloaded archive, signature file, and helper variables.

rm -f "$SWIFT_TARBALL" "${SWIFT_TARBALL}.sig"
unset SWIFT_VERSION SWIFT_TARBALL SWIFT_BASE_URL

Install Additional Swift Tarball Versions on Debian

Because each version lives in its own /opt/swift-<version> directory, you can keep multiple releases side by side. Save the current symlink target before downloading another version.

CURRENT_SWIFT_DIR=$(readlink -f /opt/swift)
ALT_SWIFT_VERSION=6.2.4
ALT_SWIFT_TARBALL="swift-${ALT_SWIFT_VERSION}-RELEASE-debian12.tar.gz"
ALT_SWIFT_BASE_URL="https://download.swift.org/swift-${ALT_SWIFT_VERSION}-release/debian12/swift-${ALT_SWIFT_VERSION}-RELEASE"
curl -fsI "${ALT_SWIFT_BASE_URL}/${ALT_SWIFT_TARBALL}" >/dev/null
curl -fsSLO "${ALT_SWIFT_BASE_URL}/${ALT_SWIFT_TARBALL}"
curl -fsSLO "${ALT_SWIFT_BASE_URL}/${ALT_SWIFT_TARBALL}.sig"

Verify the additional tarball before extracting it.

SWIFT_GPG_HOME=$(mktemp -d)
export GNUPGHOME="$SWIFT_GPG_HOME"
curl -fsSL https://www.swift.org/keys/all-keys.asc | gpg --import -
gpg --verify "${ALT_SWIFT_TARBALL}.sig" "$ALT_SWIFT_TARBALL"
rm -rf "$SWIFT_GPG_HOME"
unset GNUPGHOME SWIFT_GPG_HOME

Extract the additional version into its own directory.

sudo mkdir -p "/opt/swift-${ALT_SWIFT_VERSION}"
sudo tar xzf "$ALT_SWIFT_TARBALL" -C "/opt/swift-${ALT_SWIFT_VERSION}" --strip-components=1
test -x "/opt/swift-${ALT_SWIFT_VERSION}/usr/bin/swift"

Switch to the alternative version by repointing the symlink.

sudo ln -sfn "/opt/swift-${ALT_SWIFT_VERSION}" /opt/swift
swift --version
Swift version 6.2.4 (swift-6.2.4-RELEASE)
Target: x86_64-unknown-linux-gnu

Switch back to your primary version the same way.

sudo ln -sfn "$CURRENT_SWIFT_DIR" /opt/swift
swift --version

List all installed tarball versions at any time.

ls -d /opt/swift-* 2>/dev/null

Check which version the symlink currently points to.

readlink -f /opt/swift
/opt/swift-6.3.2

Remove the extra downloaded archive and helper variables once the additional version is installed.

rm -f "$ALT_SWIFT_TARBALL" "${ALT_SWIFT_TARBALL}.sig"
unset ALT_SWIFT_VERSION ALT_SWIFT_TARBALL ALT_SWIFT_BASE_URL CURRENT_SWIFT_DIR

Create a Swift Project on Debian

Swift Package Manager handles project scaffolding and dependency resolution, and it requires Git. Swiftly and tarball installations already include Git in the dependency set. Debian 13 APT users who do not have Git can install Git on Debian separately with sudo apt install git.

Create a directory for a new command-line tool and initialize the project.

mkdir ~/HelloSwift && cd ~/HelloSwift
swift package init --name HelloSwift --type executable

Build and run the project.

swift run HelloSwift
Building for debugging...
Build of product 'HelloSwift' complete!
Hello, world!

The Swift getting started guide covers adding dependencies, structuring larger projects, and building release binaries.

Manage Swift Installations on Debian

APT and Swiftly handle updates with built-in commands. The tarball update section includes a script that checks Swift’s Git tags for new stable versions and automates the download, verification, and symlink rotation.

Update Swift via APT on Debian 13

Debian 13 users receive Swift updates through the standard package manager alongside other system packages.

sudo apt update && sudo apt install --only-upgrade swiftlang

Update Swift Toolchains with Swiftly on Debian

Swiftly handles Swift toolchain updates independently of APT. Update the active toolchain to the latest patch release for its major version.

swiftly update

To jump to the latest stable release across all major versions, specify latest.

swiftly update latest

Install Additional Swift Versions on Debian

Swiftly supports multiple toolchains side by side, which is useful for testing code against different Swift releases.

swiftly install 5.10

Switch the active version.

swiftly use 5.10

List all installed toolchains to see which one is active.

swiftly list

Update Swiftly on Debian

Swiftly checks for new releases of itself separately from Swift toolchains.

swiftly self-update

Update Swift Tarball Installation on Debian

Tarball installations do not include an automatic update mechanism, so you need to download the new release yourself. The update-swift helper queries Swift’s official Git tags for the newest stable release, verifies that the Debian 12 tarball exists, compares it against the tarball installed at /opt/swift, downloads and verifies the new archive, extracts it to a versioned directory, and repoints the symlink. Run it manually whenever you want to check for updates.

Create a reusable update-swift command under ~/.local/bin. These commands also add that directory to the current shell when it is not already on PATH.

mkdir -p ~/.local/bin
case ":$PATH:" in
  *":$HOME/.local/bin:"*) ;;
  *) export PATH="$HOME/.local/bin:$PATH" ;;
esac

cat <<'SCRIPT' > ~/.local/bin/update-swift
#!/usr/bin/env bash
set -euo pipefail

INSTALL_BASE="/opt"
SWIFT_LINK="${INSTALL_BASE}/swift"
SWIFT_BIN="${SWIFT_LINK}/usr/bin/swift"
PLATFORM="debian12"

error() {
  printf 'Error: %s\n' "$*" >&2
  exit 1
}

if [ "$(id -u)" -eq 0 ]; then
  error "run this script as a regular user, not root."
fi

for cmd in curl git gpg head mktemp readlink sed sort sudo tar; do
  command -v "$cmd" >/dev/null 2>&1 || error "$cmd is required but not installed."
done

if [ ! -L "$SWIFT_LINK" ] || [ ! -x "$SWIFT_BIN" ]; then
  error "no tarball installation found at $SWIFT_LINK."
fi

sudo -v

echo "Checking Swift tags for the latest stable release..."
LATEST_VERSION=$(git ls-remote --tags https://github.com/swiftlang/swift.git 'refs/tags/swift-*-RELEASE' \
  | sed -E 's|.*refs/tags/swift-([0-9]+\.[0-9]+(\.[0-9]+)?)-RELEASE$|\1|; t; d' \
  | sort -V \
  | tail -n 1)

[ -n "$LATEST_VERSION" ] || error "could not detect the latest Swift version."

CURRENT_VERSION=$("$SWIFT_BIN" --version 2>/dev/null \
  | sed -nE 's/^Swift version ([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/p' \
  | head -n 1)

[ -n "$CURRENT_VERSION" ] || error "could not read the installed Swift version."

echo "Installed: Swift $CURRENT_VERSION ($(readlink -f "$SWIFT_LINK"))"
echo "Latest:    Swift $LATEST_VERSION"

if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
  echo "Already up to date."
  exit 0
fi

TARBALL="swift-${LATEST_VERSION}-RELEASE-debian12.tar.gz"
BASE_URL="https://download.swift.org/swift-${LATEST_VERSION}-release/debian12/swift-${LATEST_VERSION}-RELEASE"
INSTALL_DIR="${INSTALL_BASE}/swift-${LATEST_VERSION}"

if ! curl -fsI "${BASE_URL}/${TARBALL}" >/dev/null; then
  error "the ${PLATFORM} tarball for Swift ${LATEST_VERSION} is not available yet."
fi

TMP_DIR=$(mktemp -d)
GNUPGHOME="${TMP_DIR}/gnupg"
mkdir -m 700 "$GNUPGHOME"
export GNUPGHOME

cleanup() {
  rm -rf "$TMP_DIR"
  unset GNUPGHOME
}
trap cleanup EXIT

cd "$TMP_DIR"

echo ""
echo "Downloading Swift $LATEST_VERSION..."
curl -fsSLO "${BASE_URL}/${TARBALL}"
curl -fsSLO "${BASE_URL}/${TARBALL}.sig"

echo "Verifying Swift PGP signature..."
curl -fsSL https://www.swift.org/keys/all-keys.asc | gpg --import - >/dev/null 2>&1
if ! gpg --verify "${TARBALL}.sig" "$TARBALL" >/dev/null 2>&1; then
  error "PGP signature verification failed. Delete the downloaded tarball and retry."
fi
echo "Signature verified."

echo "Extracting to $INSTALL_DIR..."
sudo mkdir -p "$INSTALL_DIR"
sudo tar xzf "$TARBALL" -C "$INSTALL_DIR" --strip-components=1
test -x "$INSTALL_DIR/usr/bin/swift" || error "Swift binary was not found after extraction."

echo "Updating symlink $SWIFT_LINK -> $INSTALL_DIR"
sudo ln -sfn "$INSTALL_DIR" "$SWIFT_LINK"

VERIFY=$("$SWIFT_BIN" --version 2>/dev/null \
  | sed -nE 's/^Swift version ([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/p' \
  | head -n 1)

[ "$VERIFY" = "$LATEST_VERSION" ] || error "updated Swift reports $VERIFY instead of $LATEST_VERSION."

echo ""
echo "Swift updated from $CURRENT_VERSION to $VERIFY"
echo "The previous directory /opt/swift-${CURRENT_VERSION} is still on disk."
echo "Remove it with:  sudo rm -rf /opt/swift-${CURRENT_VERSION}"
SCRIPT
chmod +x ~/.local/bin/update-swift

The script performs these steps in order:

  • Confirms it is not running as root, checks required helper commands, refreshes sudo, and verifies that a tarball installation exists at /opt/swift.
  • Queries the official Swift Git tags for the newest stable release and checks that the matching Debian 12 tarball exists on Swift.org.
  • Reads the installed version from /opt/swift/usr/bin/swift directly instead of relying on your shell PATH.
  • Exits early if the installed and latest versions match.
  • Downloads the tarball and its .sig file in a temporary directory, imports Swift’s PGP keys into a temporary keyring, and verifies the signature.
  • Extracts the new release into /opt/swift-<version> and repoints the /opt/swift symlink.
  • Cleans up the temporary files automatically and prints the new version. The previous version directory is kept so you can roll back by repointing the symlink.

Run the helper to check for and apply updates.

update-swift

When an update is available, the output looks like this.

Checking Swift tags for the latest stable release...
Installed: Swift 6.3.1 (/opt/swift-6.3.1)
Latest:    Swift 6.3.2

Downloading Swift 6.3.2...
Verifying Swift PGP signature...
Signature verified.
Extracting to /opt/swift-6.3.2...
Updating symlink /opt/swift -> /opt/swift-6.3.2

Swift updated from 6.3.1 to 6.3.2
The previous directory /opt/swift-6.3.1 is still on disk.
Remove it with:  sudo rm -rf /opt/swift-6.3.1

When you are already on the latest version.

Checking Swift tags for the latest stable release...
Installed: Swift 6.3.2 (/opt/swift-6.3.2)
Latest:    Swift 6.3.2
Already up to date.

Avoid automating this script with cron. The download is nearly 1 GB and PGP verification can fail if keys rotate. Run it manually so you can monitor the output and catch any problems before they affect your projects.

Troubleshoot Swift on Debian

Fix exit(0) Requires import Glibc on Linux

On Linux, Swift gets POSIX C library functions such as exit() from the Glibc module. If a command-line Swift file fails with use of unresolved identifier 'exit', import Glibc before calling exit(0).

import Glibc

exit(0)

For code shared with macOS, use a conditional import so Linux uses Glibc and Apple platforms use Darwin.

#if os(Linux)
import Glibc
#else
import Darwin
#endif

exit(0)

Fix Swiftly Unsupported Linux Platform on Debian

Swiftly 1.1.1 detects Debian 12 as debian12. Debian 13 currently falls outside Swiftly’s recognized Linux platform list, so use the Debian 13 swiftlang package for a system-managed compiler or the Debian 12 tarball method for a current Swift.org release.

Check Which Swift Command Runs First

If you install more than one method, PATH order decides which swift command your shell runs. Check the resolved binary before debugging version mismatches.

command -v swift
swift --version

APT normally resolves to /usr/bin/swift, the tarball method resolves to /opt/swift/usr/bin/swift, and Swiftly resolves through its user-level bin directory. Adjust your profile file or remove the method you no longer want if the wrong toolchain appears first.

Remove Swift from Debian Linux

Remove Swift APT Package from Debian

Debian 13 users can remove the APT package and leave manually installed Swiftly or tarball toolchains untouched.

sudo apt remove swiftlang libswiftlang

If APT reports packages that are no longer required, review the list before accepting optional dependency cleanup.

sudo apt autoremove

Verify the APT packages are no longer installed. Debian can still show an available candidate because swiftlang remains in the repository.

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' swiftlang libswiftlang 2>/dev/null | grep '^ii' || printf 'No installed Swift APT packages found.\n'
No installed Swift APT packages found.

Remove Swiftly and Swift Toolchains from Debian

Remove all Swiftly-managed toolchains first. This does not affect an APT package or a manually extracted tarball under /opt.

This deletes every toolchain managed by Swiftly for your user account. Back up projects and confirm you do not need those toolchains before continuing.

swiftly uninstall all --assume-yes

Remove the Swiftly manager, environment file, and default binary directory. If you customized SWIFTLY_HOME_DIR or SWIFTLY_BIN_DIR, export those variables first so the cleanup targets the same locations.

SWIFTLY_HOME="${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}"
SWIFTLY_BIN="${SWIFTLY_BIN_DIR:-$SWIFTLY_HOME/bin}"
rm -rf "$SWIFTLY_HOME"
rm -f "$SWIFTLY_BIN/swiftly"

Remove Swiftly environment references from common shell profile files.

for file in ~/.profile ~/.bash_profile ~/.bashrc ~/.zprofile ~/.zshrc; do
  [ -f "$file" ] && sed -i '/# Added by swiftly/d; /swiftly\/env/d' "$file"
done

Clean up the original download files if they are still in your home directory.

rm -f ~/swiftly ~/swiftly-*.tar.gz ~/swiftly-*.tar.gz.sig

Reset the current shell’s command cache. Open a new terminal if your prompt still finds an old swiftly path.

hash -r
command -v swiftly || printf 'swiftly command not found\n'
swiftly command not found

Remove Swift Tarball Installation from Debian

List the versioned toolchain directories before deleting them. Remove or move any directory you want to keep before running the cleanup command.

find /opt -maxdepth 1 -type d -name 'swift-[0-9]*' -print

The cleanup command permanently deletes every matching /opt/swift-<version> directory, the /opt/swift symlink, and the article-created update-swift helper.

sudo rm -f /opt/swift
sudo rm -rf /opt/swift-[0-9]*
rm -f ~/.local/bin/update-swift

Remove the PATH entry from whichever profile file you used during installation.

for file in ~/.profile ~/.bashrc ~/.zshrc; do
  [ -f "$file" ] && sed -i '/\/opt\/swift\/usr\/bin/d' "$file"
done
sudo rm -f /etc/profile.d/swift.sh

Clear the current shell’s command cache. Open a new terminal if your current PATH still contains the removed /opt/swift/usr/bin entry.

hash -r

Confirm the tarball path is gone. If APT or Swiftly is still installed, swift --version may still work from that other method.

test ! -e /opt/swift
find /opt -maxdepth 1 -type d -name 'swift-[0-9]*' -print

The find command should print no matching directories after cleanup.

Conclusion

Swift is ready on Debian with the compiler, Swift Package Manager, and selected update path in place. Use Debian 13’s APT package for system-managed maintenance, Swiftly on Debian 12 for toolchain switching, or the tarball path for a current standalone install. For editor support, install Visual Studio Code on Debian; for dependency work, install Git on Debian if it is missing.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: