Install Apple Swift on Windows 10/11 Subsystem for Linux (WSL)

As you know, Microsoft built new infrastructure within Windows – the Windows Subsystem for Linux (WSL) – upon which we run a genuine Ubuntu user-mode image provided by Microsoft great partners over at Canonical, creators of Ubuntu Linux. The result is that you can now run native Bash on Ubuntu on Windows.

If you don't have a enable Ubuntu on Windows check out stepwise Guide to Enable Windows 10’s Ubuntu Bash Shell (Windows Subsystem for Linux). Here the step-vise guide to Install Swift on Windows 10 -

1. Open bash and move to root:

  • To open bash open Run (Windows Key + R) then type bash and hit enter.

  • Move to Root: Type cd and hit enter

    cd
    

2. Install required dependencies:

apt-get install clang libicu-dev

3. Download the latest swift binary release

4. Install Swift

Replace swift-3.0.1-RELEASE-ubuntu14.04.tar.gz with download file name and run this command -

tar -zxvf swift-3.0.1-RELEASE-ubuntu14.04.tar.gz

5. Change directory to swift compiler bin

cd swift-3.0.1-RELEASE-ubuntu14.04/usr/bin

6. Write your first program

7. Compile and Runt

To Compile your program type

./swiftc helloworld.swift

To Run your program type

./helloworld

Next - Introduction to Swift


Discussion

Read Community Guidelines
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.