How to Install Swift on Fedora 44

Last updated Sunday, May 17, 2026 11:10 am Joshua James 4 min read

Fedora packages Swift in its standard repositories, so the DNF path gives you a system-owned compiler, Swift Package Manager, and SourceKit-LSP without adding a separate repository. After installing the swift-lang package, you can run scripts, compile command-line tools, scaffold Swift Package Manager projects, and connect editors through sourcekit-lsp.

The Fedora package is the path to use when you want DNF-managed updates and removal. The Swift.org Fedora install page currently lists upstream tarballs and containers for Fedora 39 and Fedora 41 targets, but those toolchains have separate update and PATH ownership. For most current Fedora users, the repository package is the safer default because DNF owns the install, updates, and removal.

Install Swift on Fedora

Install Swift on Fedora with sudo dnf install swift-lang. Fedora 44 currently ships Swift 6.2 in the Fedora swift-lang package, and a clean Workstation transaction downloads about 425 MiB while using about 2 GiB after installation. The package is large because DNF adds the Swift compiler, SwiftPM, SourceKit-LSP, GCC, LLD, Make, headers, and development libraries needed by the local toolchain.

Update Fedora before installing Swift

Refresh repository metadata first so Fedora sees the current package set before you install Swift.

sudo dnf upgrade --refresh

These commands use sudo for tasks that need root privileges. If your account is not in the sudoers file yet, follow the guide on how to add a user to sudoers on Fedora.

Install Swift from Fedora repositories

Install the Fedora package next. This method keeps Swift tied to normal Fedora package maintenance instead of placing an account-local toolchain ahead of /usr/bin on PATH.

sudo dnf install swift-lang

The package installs the main Swift tools in /usr/bin/, including swift, swiftc, swift-build, swift-run, and sourcekit-lsp. Swift Package Manager is built into the swift command, so swift package works immediately after the install without a second package.

Keep the install limited to swift-lang unless you have a separate feature requirement. Fedora does not split this Swift toolchain into desktop and server packages; the same DNF package provides the command-line compiler, SwiftPM, and language-server tools on standard Fedora editions. Optional Swift-adjacent tools such as linters, editor extensions, server frameworks, and project dependencies are separate workflow choices and are not required for these first-use checks.

Verify Swift on Fedora

Check the installed RPM first so Fedora confirms the package is present.

rpm -q swift-lang
swift-lang-6.2-8.fc44.x86_64

Confirm the active compiler version after that.

swift --version
Swift version 6.2 (swift-6.2-RELEASE)
Target: x86_64-unknown-linux-gnu
Build config: +assertions

If you plan to use VS Code or another editor, confirm Fedora also installed sourcekit-lsp.

sourcekit-lsp --help | sed -n '1,2p'
OVERVIEW: Language Server Protocol implementation for Swift and C-based
languages

If all three checks match, Swift is ready to use on Fedora.

Use Swift on Fedora

Fedora’s Swift package is more than a compiler drop. The swift command handles scripts, swiftc builds standalone binaries, swift package scaffolds project structure, and sourcekit-lsp is ready when you connect an editor. Git becomes important once you start pulling external package dependencies, so install Git on Fedora if it is not already available.

These examples are first-use smoke tests. Running them confirms that Fedora’s package can interpret a script, compile a binary, and build a SwiftPM executable project before you move into a larger application.

Run a Swift script on Fedora

Create a small source file and run it directly with the Swift interpreter.

printf '%s\n' 'print("Hello, World!")' > hello.swift
swift hello.swift
Hello, World!

The swift command interprets and runs the file directly, which is handy for quick tests and small command-line utilities.

Compile a Swift executable on Fedora

Use swiftc when you want a standalone binary instead of an interpreted script.

swiftc hello.swift -o hello
./hello
Hello, World!

The swiftc binary comes from the same Fedora package as swift, so you do not need to install a separate compiler package.

Create a Swift Package Manager project on Fedora

Swift Package Manager is built into the swift command, so you can scaffold and run an executable project without extra tooling.

mkdir HelloSwift
cd HelloSwift
swift package init --name HelloSwift --type executable
swift run HelloSwift

Relevant output includes:

Creating executable package: HelloSwift
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/HelloSwift/HelloSwift.swift
Building for debugging...
Build of product 'HelloSwift' complete!
Hello, world!

The official Swift Package Manager getting started guide is the next step once you want dependencies, release builds, and a larger project layout.

Update or Remove Swift on Fedora

The Fedora repository path is system-managed, so maintenance stays inside DNF.

Update Swift on Fedora

Update Swift with the rest of the system through the normal DNF upgrade workflow.

sudo dnf upgrade --refresh

If you prefer unattended repo-managed updates, install DNF Automatic on Fedora so packages like swift-lang stay current without a manual session.

Remove Swift from Fedora

Remove the Fedora package with DNF. On Fedora 44, removing swift-lang from a clean install also removes the unused compiler dependency chain in the same transaction, so a follow-up dnf autoremove is not necessary and can sweep up unrelated packages on reused systems.

sudo dnf remove swift-lang

Verify that Fedora no longer sees the package.

rpm -q swift-lang || echo swift-lang-not-installed
package swift-lang is not installed
swift-lang-not-installed

Troubleshoot Swift on Fedora

Fix swift command not found after installing Swift

If swift does not resolve after DNF finishes, verify the RPM and clear Bash’s command cache before checking PATH again.

rpm -q swift-lang
hash -r
command -v swift

Expected output includes the installed RPM and /usr/bin/swift. The hash -r command clears Bash’s cached command lookup and does not print output.

swift-lang-6.2-8.fc44.x86_64
/usr/bin/swift

Handle Swiftly unsupported platform errors on Fedora

Swift.org’s Swiftly 1.1.1 bootstrap still exits on Fedora 44 with Error: Unsupported Linux platform during normal initialization, so it is not the Fedora install path documented here. If you only downloaded and extracted Swiftly before that failure, remove the archive and extracted swiftly binary from the directory where you tested it; the failed initialization does not create a DNF package or replace Fedora’s /usr/bin/swift.

Conclusion

Fedora now has a working Swift toolchain for scripts, compiled binaries, and SwiftPM projects, with sourcekit-lsp ready when you want editor diagnostics and autocomplete. If VS Code is your next step, install Visual Studio Code on Fedora and then follow the official Swift VS Code setup guide.

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: