In this guide, we are looking at how to install swift programming language on Ubuntu 24.04. Swift is a programming language developed from C and objective-C which uses variables to store and refer to values. Constants are used throughout. Swift programming language developed for iOS, macOS, watchOS, and tvOS development.

Swift is the best available language for all programmers systems ranging from mobile and desktop apps, even up to cloud services. it is designed to make writing and maintaining fast and safe programs. Follow the steps below to install Swift on Ubuntu 24.04.
Step 1: Update System Packages
Ensure that you have your system packages up to date before beginning your installations. Run the commands below:
sudo apt-get update && sudo apt-get upgrade -y
Step 2: Install Required Dependencies
You need to install some dependencies that are required to run Swift on Ubuntu 24.04. Run the command below:
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
Step 3. Installing swift on Ubuntu 24.04
Download the latest binary release of swift from their official download page. The swift-<VERSION>-<PLATFORM>.tar.gz
 file is the toolchain itself.
Alternatively, you can use wget to download as below:
sudo 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
Step 4. Import and verify the PGP signature
Skip this step if you have imported the keys in the past. Import the GPG key details:
gpg --keyserver hkp://keyserver.ubuntu.com \
--recv-keys \
'A62A E125 BBBF BB96 A6E0 42EC 925C C1CC ED3D 1561'\
'E813 C892 820A 6FA1 3755 B268 F167 DF1A CF9C E069'
OR
wget -q -O - https://swift.org/keys/all-keys.asc | \
gpg --import -
Step 5. Extract the tarball
Now extract the downloaded file and configure the swift binary to system’s PATH environment variable.
tar xzf swift-6.0.3-RELEASE-ubuntu24.04.tar.gz
rm -f swift-6.0.3-RELEASE-ubuntu24.04.tar.gz
sudo mv swift-6.0.3-RELEASE-ubuntu24.04 /usr/share/swift
echo 'export PATH=/usr/share/swift/usr/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
Step 6: Verify Swift Installation
We can check for the installed version of swift to confirm that it is properly installed
$ swift --version
Swift version 6.0.3 (swift-6.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu
Step 7: Run a simple Swift Program
To enter Swift command line, simply type ‘swift‘ on your terminal and press ‘Enter‘
$ swift
Welcome to Swift!
Subcommands:
swift build Build Swift packages
swift package Create and work on packages
swift run Run a program from a package
swift test Run package tests
swift repl Experiment with Swift code interactively
Use `swift --version` for Swift version information.
Use `swift --help` for descriptions of available options and flags.
Use `swift help <subcommand>` for more information about a subcommand.
To run a simple Hello World program, create a file hello.swift
:
echo 'print("Hello, Swift on Ubuntu!")' > hello.swift
Run the Swift script:
$ swift hello.swift
Hello, Swift on Ubuntu!
That’s it. You have successfully installed Swift programming language on Ubuntu 24.04 and run your first simple program. Swift is quite interesting due to the various uses it supports. It is easy to use. Enjoy! More interesting guides on programming below: