Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»How to Install Swift on Ubuntu 18.04 LTS

    How to Install Swift on Ubuntu 18.04 LTS

    RahulBy RahulDecember 10, 20182 Mins ReadUpdated:December 28, 2018

    Swift is a safe, fast, expressive general-purpose programming language build for the software design patterns. It is best for the systems programming, to mobile and desktop applications. Swift provides a large number of features that make programming easier while giving the developer the control needed in a true systems programming language.

    This tutorial will help you to install swift programming language on your Ubuntu 18.04 LTS Bionic Linux system.

    Step 1 – Prerequisites

    Login to your Ubuntu 18.04 system using SSH (Shell) access. Now install the required dependencies for swift installation on your system.

    sudo apt-get install clang
    

    For the new Ubuntu 18.04 installation, I also needed to install following packages to work swift properly.

    sudo apt-get install libcurl3 libpython2.7 libpython2.7-dev 
    

    Step 2 – Install Swift Ubuntu 18.04

    Now, you need to download the latest available swift release from its official site. You can use below command to download Swift 4.2.1 on the Ubuntu 18.04 Bionic system.

    wget https://swift.org/builds/swift-4.2.1-release/ubuntu1804/swift-4.2.1-RELEASE/swift-4.2.1-RELEASE-ubuntu18.04.tar.gz
    

    Then extract the downloaded archive

    tar xzf swift-4.2.1-RELEASE-ubuntu18.04.tar.gz
    sudo mv swift-4.2.1-RELEASE-ubuntu18.04 /usr/share/swift
    

    Also, configure the swift binary to system’s PATH environment variable.

    echo "export PATH=/usr/share/swift/usr/bin:$PATH" >> ~/.bashrc
    source  ~/.bashrc
    

    Step 3 – Verify Swift Version

    Use the following command to check the current installed Swift version on your system.

    swift --version
    
    Swift version 4.2.1 (swift-4.2.1-RELEASE)
    Target: x86_64-unknown-linux-gnu
    

    Step 4 – Swift REPL Examples

    Just type swift on your system console and you will get Swift console. You can use this console for quick operations and for the learning purpose.

    swift
    
    Welcome to Swift version 4.2.1 (swift-4.2.1-RELEASE). Type :help for assistance.
      1>
    

    Now, run some sample commands to test the console running properly.

    Install Swift Ubuntu 18.04

    Swift Ubuntu 18.04
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install CodeIgniter on Ubuntu 16.04 (Xenial)
    Next Article How to Install CakePHP on Debian 9 (Stretch)

    Related Posts

    How to Install JAVA on Ubuntu 22.04

    Updated:May 16, 20224 Mins Read

    How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04

    Updated:May 9, 20223 Mins Read

    How To Install Node.js on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install NVM on Ubuntu 22.04

    Updated:April 16, 20223 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    Java HashMap – How to Get Value from Key

    Updated:April 6, 20222 Mins Read

    6 Comments

    1. jhon wicked on May 31, 2019 11:23 pm

      gracias from Peru

      it works just perfect!!

      Reply
    2. bruce davidson on May 13, 2019 7:44 pm

      Don’t use this on windows subsystem for linux. This broke my .bashrc file:

      -bash: /home/bruce/.bashrc: line 120: syntax error near unexpected token `(‘

      This is actually due to the fact that wsl inherits the windows path, and can insert a reference like this one:
      :/mnt/c/Program Files (x86)/Yarn/bin:

      You should instead use nano to modify the path manually.

      Reply
      • hamadaag on February 27, 2020 9:20 am

        can you explain more?

        Reply
    3. Lane on March 10, 2019 4:00 pm

      Here’s what happens when I try to run ‘swift’:

      /usr/share/swift/usr/bin/lldb: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

      Reply
    4. TIKI on February 23, 2019 6:02 pm

      huge help! Thanks

      Reply
    5. Roni on January 2, 2019 9:13 am

      Dear Mr.Rahul ,

      I got problem in step 2 ,
      ………
      Reading package lists… done
      Building dependecy tree
      Reading state information… done
      E: Unable to locate package lib
      ……….

      Could you help me to solve it , i am newbie about this

      Regards,
      Ron

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.