APT Repositories for Swift 3.0
Editor’s Note: This post has been updated as of September 13, 2016 to reflect the official release of Swift 3.0.
Swift 3.0 has officially been released as of September 13, 2016!
.tar.gz from Apple is nice. Using
apt-get on an Ubuntu distribution is even better. To make it is easy to get started with Swift on Linux, we’ve provided an Ubuntu repository that you can obtain the latest Swift packages from.
1. Add the repository key
wget -qO- http://dev.iachieved.it/iachievedit.gpg.key | sudo apt-key add -
2. Add the appropriate repository to
Ubuntu 14.04 (Trusty Tahr)
echo "deb http://iachievedit-repos.s3.amazonaws.com/ trusty main" | sudo tee --append /etc/apt/sources.list
Ubuntu 15.10 (Wily Werewolf)
echo "deb http://iachievedit-repos.s3.amazonaws.com/ wily main" | sudo tee --append /etc/apt/sources.list
Ubuntu 16.04 (Xenial Xerus)
echo "deb http://iachievedit-repos.s3.amazonaws.com/ xenial main" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
4. Install swift-3.0!
apt-get install swift-3.0
5. Update that
Our packages install Swift in
Even better, update your
.zshrc, etc. script and permanently add
/opt/swift/swift-3.0/usr/bin to your
6. Try it out
git clone https://github.com/apple/example-package-dealer cd example-packager-dealer swift build Compiling Swift Module 'FisherYates' (1 sources) Linking Library: .build/debug/FisherYates.a Compiling Swift Module 'PlayingCard' (3 sources) Linking Library: .build/debug/PlayingCard.a Compiling Swift Module 'DeckOfPlayingCards' (1 sources) Linking Library: .build/debug/DeckOfPlayingCards.a Compiling Swift Module 'Dealer' (1 sources) Linking Executable: .build/debug/Dealer
Q. Did Apple build these binaries?
A. No, I built them on my personal server using the instructions I posted here.
Q. What git revisions are included in the build?
A. You can use
apt-cache show swift-3.0 to see this information. For example:
# apt-cache show swift-3.0 Package: swift-3.0 Conflicts: swift-2.2 Version: 1:3.0-0ubuntu14+xenial1 Architecture: amd64 Installed-Size: 379197 Maintainer: iachievedit (firstname.lastname@example.org) Depends: clang (>= 3.6), libicu-dev Homepage: http://dev.iachieved.it/iachievedit/swift Priority: optional Section: development Filename: pool/main/s/swift-3.0/swift-3.0_3.0-0ubuntu14+xenial1_amd64.deb Size: 73949420 SHA256: 5a7231d307bfb6564ec931313bfaf1a9442d5a8a911afe8e7f9ed08fbb767fca SHA1: ad3698e81b80a61f960536413e1ec6d69167a4ee MD5sum: 3e7976a0874d1894cb6fb3222bd743f8 Description: Open Source Swift This is a packaged version of Open Source Swift 3.0 built from the following git revisions of the Apple Github repositories: Clang: 968470f170 LLVM: 0e49d60410 Swift: 13f05f0094 Foundation: 2eccd197f2 Description-md5: b4a6698ebeacd64f3d3dff2b5698e9de
The source tree is untouched for each build.
Q. Do you test the binaries before you upload them?
A. The Swift build process tests the resulting binaries, and I then do run some basic tests and compile my own applications, but there is currently no separate exhaustive test suite.
Q. Are you releasing builds on a set schedule?
A. Not really, though I may try to stay in sync with the releases from Apple. The idea was to get something out for folks to experiment with and start coding Swift on Linux.
Q. Where is everything installed?
A. Everything gets put in
Q. How do I decipher the package version number?
A. This was my first take on what I thought should be an appropriate package version number. Breaking it down,
3.0-0ubuntu2~trusty1 should be:
- 3.0 is the version of Swift that is packaged
- -0ubuntu2 indicates that this is the 2nd package for Ubuntu, with the 0 indicating that there is no upstream Debian package upon which this package was based
- ~trusty1 indicates that this package is for Trusty Tahr
I think I got that right, but if you feel otherwise please do drop me a line at
How Does This Work?
I used these awesome instructions on how to host a Debian package repository on Amazon S3. I tried to set up a Launchpad PPA, but quite frankly, got tired of trying to wade through all the metadata required to put together a simple package. I’m sure for hosting distribution repositories it’s all required, but for this it felt like overkill. The folks that develop fpm also have some choice things to say about it.
The packaging scripts we use to build everything and upload to the repository can be found Github. For Swift 3.0 make sure and look at the