Recently, I had to use Swift on Debian for a small project of mine.
There are various installation procedures on the web for installing Swift on Linux but they’re mostly for Ubuntu. Since things change with every Linux distribution, I want to share what I did.
The following procedure will cover installing Swift 4.1.2
on Debian Jessie
.
- Make sure your Debian system is up-to-date,
1
|
apt-get update && sudo apt-get upgrade
|
- Install the dependencies required by Swift,
1
|
apt-get install clang libicu-dev
|
- Check that you’ve
alien
installed. We’ll need it later on,
1
|
sudo apt-get install alien
|
- Download Swift with whatever you want. I prefer
wget
. Since we’re on Debian Jessie, you should opt for the Ubuntu 14.04 download of Swift 4.1.2 since Ubuntu 14.04 supports Debian Jessie.
1
|
wget https://swift.org/builds/swift-4.1.2-release/ubuntu1404/swift-4.1.2-RELEASE/swift-4.1.2-RELEASE-ubuntu14.04.tar.gz
|
1
|
tar -xvzf swift-4.1.2-RELEASE-ubuntu14.04.tar.gz
|
- Enter into the uncompressed directory
1
|
cd swift-4.1.2-RELEASE-ubuntu14.04
|
- Compress the
usr
directory into a tar.gz
1
|
tar -cvzf swift-4.1.2.tar.gz usr
|
- Use
alien
to generate a .deb
package,
1
|
alien -v swift-4.1.2.tar.gz
|
- Install your newly created
.deb
package
1
|
dpkg -i swift_4.1.2_all.deb
|
That’s it. Now you can enter into Swift by typing swift
into your shell prompt or compile your Swift files with swiftc
.
under construction...