top of page

How to Install Swift on Ubuntu

Swift is a programming language built by Apple. It is a new-generation, fast, opensource and enjoys a huge community support. But for learning and working on Swift, one needs to setup the environment on MAC. In a typical office setup, we don’t have many MAC machines so it’s better we find some way to set it up on our Personal Computer. In the below article is outlined one such way.

To be honest, you cannot run Swift on your Windows PC directly. You must create a Linux VM on windows using Hyper-V or Oracle VirtualBox. Below steps use VirtualBox in the installation.

So let’s have a look at the steps -

1. Download and Install VirtualBox for Oracle from here. Ensure that it is up and running after the install.

2. Download Ubuntu 18.04 LTS from the Ubuntu from here.

3. Create an Ubuntu VM (64-bit ) in VirtualBox. Choose 3 GB memory and 100 GB dynamic storage. Choose BRIDGE adapter under network. Give the VM a name that identifies your Ubuntu 16.04 VM. Wait for the installation to finish and store the username and password at a safe place.

These steps are to be followed in the Ubuntu VM.

1. Login to the Ubuntu VM and Open a terminal

2. Install clang. The Clang project provides a language front-end and tooling infrastructure for languages in the C language family. Below is the command

sudo apt-get install clang

3. Download Swift binaries for Ubuntu ( from the browser; download the Ubuntu 16.04 binaries). This will be a tar file.

4. Extract the tar file to a location of your choice and navigate to the /usr/bin folder in the extracted folder.

5. Open a terminal from this location. Type pwd to get the current working directory. Copy the path.

6. Add this path to the system PATH variable. One way to do this in a persistent way is to add it to the bashrc file.

a. In a Terminal session, type ‘vim ~/.bashrc’

b. Press any key to enter edit mode.

c. Add this line in the file.export PATH=<pathtouserbin>:$PATH

d. Press Escape and then ‘:wq’ to save your changes to the file.

e. Restart your VM by giving the reboot command

7. Open a terminal and type ‘swift --version’. If everything works fine, you should see the version of swift you are running.

Visual Studio Code is a good IDE for development. Since you wouldn’t have Xcode on Ubuntu, VSC is a good alternative.

Download Visual Studio Code for Linux and install it.

Install the Swift plugin for Visual Studio Code ( Just go to the Extensions tab and search for Swift. Install the extension by Martin Kase.


Featured Posts
Check back soon
Once posts are published, you’ll see them here.
Recent Posts
Search By Tags
No tags yet.
Follow Us
  • LinkedIn Social Icon
  • Facebook Basic Square

Tel: 91-907-501-8793, 91-982-141-8793

bottom of page