- Prerequisites:
sudo apt-get install clang libcurl3 libpython2.7 libpython2.7-dev
- Download latest stable version from official website: https://swift.org/download/#releases
For example:
wget https://swift.org/builds/swift-5.2.1-release/ubuntu1804/swift-5.2.1-RELEASE/swift-5.2.1-RELEASE-ubuntu18.04.tar.gz
- Untar and move the folder to some places on disk:
sudo mv swift-5.2.1-RELEASE-ubuntu18.04 /opt/swift
- Add to environment of shell (bash or zsh).
- Check version by using:
swift --version
IMPORTANT:
If you get stuck with error like this: error while loading shared libraries: libtinfo.so.5
, you need install an additional package to make it works:
sudo apt install libncurses5