In this article, we will see how to start up Apple’s Swift programming in Ubuntu 14.04 ( code named Trusty).
1. Install the library ‘clang’
In Ubuntu, open a terminal and enter the command given below :
$ sudo apt-get install clang
2. Download the latest version of Swift for Ubuntu 14.04 from the given below link :
https://swift.org/download/
3. Extract the downloaded file ( swift-2.2-SNAPSHOT-2015-12-10-a-ubuntu14.04.tar.gz ) to /usr/local
$cp swift-2.2-SNAPSHOT-2015-12-10-a-ubuntu14.04.tar.gz /usr/local $cd /usr/local $sudo tar -xvzf swift-2.2-SNAPSHOT-2015-12-10-a-ubuntu14.04.tar.gz
4. Add the bin directory to the PATH
environment variable
Open the file /etc/profile in vim
$vim /usr/local/swift-2.2-SNAPSHOT-2015-12-10-a-ubuntu14.04/usr/bin
Add the bin directory to the PATH
PATH=$PATH:/usr/local/swift-2.2-SNAPSHOT-2015-12-10-a-ubuntu14.04/usr/bin
Re-open the terminal
5. Execute the command swift
in a terminal
$swift
Now an interactive shell called Read-Eval-Print-Loop ( REPL ) is opened to work with Swift programming language in Ubuntu Linux
6. Reference
https://swift.org/getting-started/
Comments on this post