Skip to content
Follow
Ubuntu Linux

How to Install Swift on Ubuntu 24.04

Richard
Written by
Richard
Dec 18, 2024 Updated Jun 20, 2026 3 min read
How to Install Swift on Ubuntu 24.04
How to Install Swift on Ubuntu 24.04

You can install Swift on Ubuntu 24.04 by downloading the official Swift toolchain directly or by using the system’s package manager.

Swift is a powerful, open-source programming language developed by Apple, designed for building everything from mobile apps to server applications. Its availability on Linux systems like Ubuntu 24.04 unlocks significant cross-platform development potential.

This guide helps you get Swift up and running on your Ubuntu 24.04 LTS system, focusing on the latest stable releases.

You can leverage Swift for web development, system programming, and even mobile development for platforms beyond Apple’s ecosystem.

⚡ Quick Answer

Install Swift on Ubuntu 24.04 by first installing prerequisite packages using apt. Then, download the Swift toolchain binary from the official Swift website, verify its signature, extract it to /opt, and add Swift’s bin directory to your PATH.

Prepare Ubuntu

Your Ubuntu 24.04 system needs to be ready before you install Swift. First, check your Ubuntu release and codename using the ‘lsb_release -a’ command to confirm it’s version 24.04 with the codename ‘noble’. This ensures you download the correct Swift version.

Then, download the appropriate version of Swift for your system.

Run the command to verify the Ubuntu release and codename of your system.

💻Code
lsb_release -a

If you run Ubuntu 24.04, the command should return release version 24.04 and codename noble.

After that, install these packages on Ubuntu.

🐧Bash / Shell
sudo apt-get install binutils git gnupg2 libc6-dev libcurl4-openssl-dev libedit2 libgcc-13-dev libncurses-dev libpython3-dev libsqlite3-0 libstdc++-13-dev libxml2-dev libz3-dev pkg-config tzdata unzip zlib1g-dev

Download Swift

Now that your Ubuntu system is prepared, you can download Swift for Ubuntu 24.04. Use the ‘wget’ command to grab the Swift 6.0.3 binary, or replace the version number with the latest release from the official Swift download site.

You can also use the command below to download Swift 6.0.3 binary. Replace the version number with the latest.

💻Code
wget https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu24.04.tar.gz

Before you install, it’s important to download the Swift GPG key (a security key to verify package authenticity) for its packages. Run this command:

💻Code
wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import -
gpg --keyserver hkp://keyserver.ubuntu.com --refresh-keys Swift
⚠️Warning
Next, download the Swift signature file for the installer and verify it by running the command below.
💻Code
wget https://download.swift.org/swift-6.0.3-release/ubuntu2404/swift-6.0.3-RELEASE/swift-6.0.3-RELEASE-ubuntu24.04.tar.gz.sig
gpg --verify swift-6.0.3-RELEASE-ubuntu24.04.tar.gz.sig

Finally, extract the downloaded installer and move the file into the /opt directory.

💻Code
tar xzf swift-6.0.3-RELEASE-ubuntu24.04.tar.gz
sudo mv swift-6.0.3-RELEASE-ubuntu24.04/* /opt/swift

Configure Swift

After downloading and extracting Swift, you need to add it to your system’s PATH. This lets you run Swift commands from any directory. Use the ‘echo’ command to add Swift’s bin folder to your PATH and then ‘source’ your profile to apply the changes.

Command Prompt
echo "export PATH=$PATH:/opt/swift/usr/bin" >> $HOME/.profile
source $HOME/.profile

To verify that Swift is installed and ready, run the command below.

💻Code
swift --version

The command should return the current version that was installed.

You can start Swift by running the command below.

💻Code
swift

That should do it.

Conclusion:

So, installing Swift on Ubuntu 24.04 gives you a powerful tool for cross-platform development. Here are the key takeaways:

  • Versatility: Swift allows for developing applications across multiple operating systems, enhancing your ability to reach a broader audience.
  • GPG Key Security: Downloading and verifying the Swift GPG key ensures the integrity and authenticity of your installation.
  • Easy Installation: The installation process is straightforward, making it accessible for developers of all experience levels.
  • Path Configuration: Properly setting the command PATH is essential for utilizing Swift commands seamlessly in your terminal.
  • Ready for Development: Swift is instantly available to develop robust applications in a Linux environment after installation.

By following these steps, you can successfully leverage the capabilities of Swift on Ubuntu, expanding your development toolkit.

Where to install Swift?

The best place to install Swift on Ubuntu 24.04 is directly from the official Swift.org install page, which provides the most up-to-date instructions and toolchains.

Can Swift be installed on Linux?

Swift.org provides download packages for Ubuntu 16.04, Ubuntu 18.04, Ubuntu 20.04, CentOS 7, CentOS 8, and Amazon Linux 2. Other distributions also have official support, such as Fedora, Red Hat Enterprise Linux 8, Raspbian OSi, etc.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04
How to Install i-doit on Ubuntu with Apache
CMS How to Install i-doit on Ubuntu with Apache

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *