In this tutorial, we will show you how to install Swift Programming Language on Ubuntu 20.04 LTS. For those of you who didn’t know, Swift is a modern open-source high-performing programming language. Mainly it is used for iOS app development but, you can use it for systems programming, cloud services, and design other applications. It was developed by Apple and released in 2014. Swift was designed as a replacement for the older Objective-C language.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step installation of Swift Programming Language on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
Install Swift Programming Language on Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Installing Required Dependencies.
We need to install some dependencies that are required to run Swift on the Ubuntu system:
sudo apt install clang libicu-dev libpython2.7-dev libtinfo5 libncurses5 libpython2.7 libz3-dev
Step 3. Installing Swift Programming Language on Ubuntu 20.04.
Now we download the Swift installer from the official website:
Next, extract the downloaded file and configure the swift binary to the system’s PATH environment variable:
tar xzf swift-5.3.3-RELEASE-ubuntu20.04.tar.gz sudo mv swift-5.3.3-RELEASE-ubuntu20.04 /usr/share/swift echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc source ~/.bashrc
Swift is now installed. Let’s verify that it works by using the following:
$ swift --version Swift version 5.3.3 (swift-5.3.3-RELEASE) Target: x86_64-Ubuntu-linux-gnu
Congratulations! You have successfully installed Swift. Thanks for using this tutorial for installing Swift Programming Language on Ubuntu 20.04 LTS (Focal Fossa) system. For additional help or useful information, we recommend you check the official Swift website.