In this article, we will have explained the necessary steps to install and configure Swift on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Announced in 2014, the Swift programming language has quickly become one of the fastest-growing languages in history. Swift is a modern, fast, and powerful general-purpose programming language. Mainly it is used for iOS app development but, you can use it for systems programming, cloud services, and design other applications.
Install Swift on Ubuntu 20.04
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install clang libicu-dev
Step 2. Install Swift on the Ubuntu system.
Download the latest available swift release from its website:
Then, extract the downloaded package into a folder in our home directory (you can use another directory),
tar xzf swift-5.3.3-RELEASE-ubuntu20.04.tar.gz sudo mv swift-5.3.3-RELEASE-ubuntu20.04 /usr/share/swift
Next, configure the swift binary to the system’s PATH environment variable:
echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc source ~/.bashrc
Swift version 5.3.3 (swift-5.3.3-RELEASE) Target: x86_64-unknown-linux-gnu /usr/share/swift/usr/bin/lldb "--repl=-disable-objc-interop -color-diagnostics" Welcome to Swift version 5.3.3 (swift-5.3.3-RELEASE). Type :help for assistance. 1>
Step 3. Swift REPL Examples.
swift on your system console and you will get Swift console. You can use this console for quick operations and for learning purposes.
swift Welcome to Swift version 5.3.3 (swift-5.3.3-RELEASE). Type :help for assistance. 1>
That’s all you need to do to install Swift on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Swift Programming Language, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.