CLion and Linux toolchain on Windows are now friends!

Posted on by Anastasia Kazakova

In this post we’ll discuss how to work with WSL in CLion and how Windows users can benefit from this support.

Why do I need it?

CLion is a cross-platform IDE, that means you can run it on Windows, Linux, and macOS. From the very beginning it works with GCC and Clang compilers, which means on Windows it requires Cygwin or MinGW (or MinGW-w64). Later we introduced Microsoft Visual C++ compiler support, for those users who have it installed and want to use inside CLion on Windows.

Besides, we know that there are C++ developers who have Windows desktops but require Linux toolchain for building their projects. Cygwin could be a work-around. With Windows 10 Microsoft however introduced an even better way – Windows Subsystem for Linux. You simply get the prefered Linux distribution (Ubuntu, OpenSUSE and SLES are supported), configure the WSL and enjoy your new Linux environment in Windows. And now you can benefit from it in CLion!

That means the following is possible:

  • Configure WSL toolchains in CLion on Windows
  • Use CMake, C, and C++ compilers from Linux in CLion running on your Windows machine
  • Debugger support is available
  • Catch memory errors and leaks right from the IDE with the Valgrind Memcheck integration


Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10. Let’s start with the simple instruction on how to set it all up:

  • Update your Windows 10 machine to the latest “Fall Creators Update” (mininum version 1709, build 16299.15).
  • Install WSL distribution, for instance Ubuntu.
  • Run Ubuntu, create a new user, keep in mind username:password.
  • Setup Ubuntu WSL environment:
    • install cmake, gcc, or/and clang,
    • configure and run openssh-server.

    Check script that can help you with the configuration:

    wget && bash

    If you are using Linux distribution different from Ubuntu, you might need some adjustments to the script.

  • To check the ssh connection, run the follow command in your WSL distribution: ssh username@localhost -p <port_number> (2222 in case of our script)

Full instruction on our confluence page.

Configure WSL toolchain in CLion

Starting with the CLion 2018.1 EAP you can use WSL as a toolchain in CLion. Go to Build, Execution, Deployment | Toolchains and select WSL in the environments dropdown:

Configure remote credentials (provide port, username and password):

Check if everything is connected and working, CMake, C, and C++ compilers are detected and available to use:

Known issues and limitations

  • There is a known issue is with the mixed case-sensitivity. Due to the IntelliJ platform issue, there is an issue with WSL file-system which is case-sensitive and Windows FS which is not. As workaround you can pass properties (Help -> “Edit Custom Properties…”):, restart an IDE and rebuild the project index (File -> “Invalidate Caches and Restart”) after that.

That’s it! And a short demo at the end:

What’s next

WSL support is a first step to implement full remote development support in CLion. It’s planned to work over ssh, just the same way the WSL now works in CLion, and will be available on all platforms.

We encourage our Windows users to try out the new WSL toolchains support in CLion, and report any issues they find to our bug tracker.

Your CLion Team
The Drive to Develop

Comments below can no longer be edited.

54 Responses to CLion and Linux toolchain on Windows are now friends!

  1. Mats Brorsson says:

    January 24, 2018

    This is great news. But how can you get the EAP versio to use the same license as the regular one? I cannot find an option to enter activation code.

    • Anastasia Kazakova says:

      January 24, 2018

      EAP is free and the build is valid for one month. So you don’t need a license to use it

  2. Christian says:

    January 25, 2018

    Should we be able to select an WSL instance which is not within AppData/… ?
    There’s a […] Button but it’s disabled for me, so I cannot select my WSL instance located in C:/Linux/ubuntu

    • vasily_romanikhin says:

      January 25, 2018

      At the moment CLion doesn’t allow to choose custom WSL location, it works only with WSL distributions which are installed via the Windows Store.

      • Stuart Bowman says:

        March 8, 2018

        Super bummed about this limitation! When will you allow user-selected WSL distributions? (I only ask because I’m unable to update my Win10 to the latest, so I’m using an older WSL binary that is not in AppData/.)

  3. Evangelos Karafantalos says:

    January 25, 2018

    I’m trying to test WSL feaute but I keep getting “Credentials are not valid for this WSL distribution(Ubuntu).”

    However I can normally ssh both from putty and withing WSL.

    Bear in mind I’m using a custom port(changed correctly) for ssh and my username is case sensitive(I’ve also added the custom property).

    WSL Version: Ubuntu 16.04.3 LTS as reported from Clion.

    • vasily_romanikhin says:

      January 26, 2018


      I’ve created an issue ( for your question, let’s discuss the details in the ticket. Could you please describe in the ticket which windows version (build number) you use, the way of WSL installation.

  4. Arty says:

    February 24, 2018

    Really looking forward to custom paths for Cmake and compilers. WSL Ubuntu ships with Cmake 3.5.1 which is too low for most of our projects (we use 3.8)

    • vasily_romanikhin says:

      February 26, 2018

      1. As temporarily solution you could try to replace the original cmake with your custom cmake using symlinks.

      2. Here’s the issue for your requirement:

    • Christian says:

      March 27, 2018


      I had also problems with the old CMake version. For the latest build (2018.1 RC build 181.4203.505) you can change the CMake path in the settings of the WSL toolchain (File | Settings | Build, Execution, Deployment | Toolchains).

      Note: You can change the parameters for CMake in the settings too (File | Settings | Build, Execution, Deployment | CMake). Make sure to choose the WSL toolchain.

      I am very pleased with this toolchain, since it replaces an annoying toolchain for me (WSL running an XServer that serves CLion to an XClient running on Windows itself).

  5. yuanhonglong says:

    March 30, 2018

    I followed all the steps,but when I run :
    ssh sworddestiny@localhost -p 2222
    I get an error :
    ssh: connect to host localhost port 2222: Connection refused

    • yuanhonglong says:

      March 30, 2018

      and Clion can not connect to my WSL 🙁

    • Vasily Romanikhin says:

      April 1, 2018

      Which WSL distribution do you use?

      If it’s not critical for you I’d recommend to reinstall Ubuntu WSL-distribution and use this instruction (

      If it doesn’t help please check your Firewall (or other Antivirus software) settings, it can block ssh connection.

      • Vasily Romanikhin says:

        April 1, 2018

        > and Clion can not connect to my WSL

        It’s predictable, because your ssh connection is configured properly.

      • yuanhonglong says:

        April 4, 2018

        I use windows 10 version 16299.309. My WSL is ubuntu. I closed the firewall and reinstalled my WSL.B!U!T! Nothing good.

        I have used ubuntu for years.I followed all the instructions and checked the output. I think some (ipv6) network error happened. Maybe I should change my software source (I’m a Chinese),or change the sshd config to listen the ipv6 network.

        Unfortunately, I have no more time. So I just delete my WSL. Ubuntu desktop is much better than WSL, isn’t it?
        (By the way, I also have Mingw. I can use Clion both in Windows and Ubuntu desktop. Why I must use WSL?)

        • Vasily Romanikhin says:

          April 4, 2018

          > Ubuntu desktop is much better than WSL, isn’t it?
          It depends, some people prefer Windows (or they have to use Windows) and in the same time they need Linux development environment. In that case WSL is good alternative to virtual machine.

          > Why I must use WSL
          You don’t have to use WSL, especially if you use UbuntuOS.
          But for Windows users it can be convenient, for example using WSL you can run your program on Valgrind, which originally is not available for Windows.

          • yuanhonglong says:

            April 5, 2018

            You are right, a person who use both UbuntuOS and Windows didn’t need a WSL or virtual machine. I am wasting my time.

            I am just curious about WSL.
            And finally find nothing useful for me. =_=!

            Thank you.

  6. Luca says:

    April 10, 2018

    Does this WSL toolchain support access to a remote server? i.e. in remote credentials provide a username and ip address of a separate machine running an ssh server? This would allow me to develop on Windows but build on a remote linux server.

    • Anastasia Kazakova says:

      April 10, 2018

      For now it’s implemented for WSL case only (one machine with Windows 10 and WSL set). But later this year we plan to implement a full remote access feature.

  7. Alireza Naghizadeh says:

    April 29, 2018

    Hi, can you please also add the swift support for this method? In this way we can easily use swift on windows, right now only c and c++ works.

  8. sancelot says:

    June 1, 2018

    I am not interested in using WSL, but using ssh connection to compile using a remote system.
    unfortunately this does not seem being possible ????


    • Anastasia Kazakova says:

      June 1, 2018

      It’s possible now only with WSL. But we hope to have proper remote compile support this year.

  9. Alex. says:

    July 27, 2018

    Tell me please, if I need to copy it to the address /usr/sbin after compiling the project, how can this be done? Copy there, and already from there run this project.
    Thank you.

    • Alex. says:

      July 27, 2018

      Now i use CLion 2018.2

    • Anastasia Kazakova says:

      July 27, 2018

      Copy what? I guess you have your sources available at WSL, build and launch there automatically via CLion

      • Alex. says:

        July 27, 2018

        I compile the project, I get the binary file.
        And I need to copy it into /usr/sbin, and run.
        Is it possible?

        • Alex. says:

          July 27, 2018

          I think that this is a connection to ssh.

        • Anastasia Kazakova says:

          July 27, 2018

          Hm. I guess you can write a script that copies and runs it, and then point CLion to this script as an executable in the Run Configuration. So CLion will call it when you hit run in the IDE for this configuration.

  10. CodeDawg says:

    December 22, 2018

    I am not able to create the WSL toolchain:

    I am running CLion v2018.3.2 and WSL on Windows 10.

    CLion: File>Settings>Build>Toolchains>Environment set to WSL
    Error message “Not specified” underneath an empty text box.
    Also, the dialog won’t let me manually select the WSL executable.

    Downloaded and ran the ubuntu_setup_env script. I can connect to WSL using SSH, but the error message under “Credentials” in the settings dialog reads:
    “There is no available WSL distribution”

    From the WSL terminal:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.5 LTS
    Release: 16.04
    Codename: xenial

    From the PowerShell terminal:
    wslconfig /l /all
    Windows Subsystem for Linux Distributions:
    Legacy (Default)

    I currently have a working toolchain using Cygwin.

    Any suggestions on how to get the WSL toolchain working?

    • Vasily Romanikhin says:

      December 24, 2018

      “Legacy” WSL is not supported by CLion.
      Make sure that Windows version is 1709 (build 16299.15) or higher and install new WSL distribution from Windows Store (e.g. Ubuntu 16.04 LTS

      • CodeDawg says:

        January 1, 2019

        Thank you Vasily. After installing a new WSL distro I was able to setup the CLion toolchain with it.

        There were some issues along the way. These were the steps I took to solve the problems:

        Installed Ubuntu 18.04 from the Windows Store and set it as “default” using wslconfig.exe. Ran the ubuntu_setup_env in the new Bash shell.

        CLion (or any other terminal) still failed to authenticate the WSLuser/password. Task manager showed that there were several ssh tasks running so I manually shut those down.

        Another attempt to ssh into WSL failed with a “man in the middle” attack warning and a suggestion to remove the host key.

        After removing the host key I was able to ssh into WSL as well as setup the CLion toolchain.

  11. Mariusz says:

    February 26, 2019

    Hi there,
    Maybe it’s a stupid question, but what’s the password to the ssh port?

    • Anastasia Kazakova says:

      February 26, 2019

      That’s the password for the user you create on WSL.

  12. Wiktor says:

    March 6, 2019

    Is it possible to use the WSL terminal in CLion? If yes, how do I do that?

    • Vasily Romanikhin says:

      March 7, 2019

      No, it’s not possible to use directly WSL terminal in CLion.
      But if you successfully setup WSL toolchain in CLion you can open remote terminal Tools -> Start SSH session (in your case it will be WSL terminal).

  13. Daniel Desery says:

    April 11, 2019

    I now made it through all the steps, including the check with “ssh [user]@localhost -p2222” and this also worked.

    But CLion still can´t find the toolchain, it´s saying “not found” for the first listbox (where ubuntu.exe is configuered, which is in the right location!)

    I am using
    – Windows 10, 1709/16299.904
    – CLion 2019.1, 191.6183.77 March 25 2019

    Many thanks and cheers,

    • Vasily Romanikhin says:

      April 11, 2019

      Hi Daniel,
      It seems that you use old Windows version.

      The original reason of the problem is WSL issue ( which was fixed in 1803 Windows update.
      So to get CLion 2019.1 work with WSL (in case you use old Windows10 version) you can enable wsl.close.process.input Registry option (Help -> Find Action -> type “Registry”) OR you can update your Windows machine (>= 1803 version).

      You can find the additional details in the ticket

      • Daniel Desery says:

        April 15, 2019

        Great, thanks!

  14. tom says:

    August 11, 2019

    how should I use Third-party libraries in Clion with WSL enviroment

    • Anastasia Kazakova says:

      August 12, 2019

      If the library is available on WSL, just add it in your CMake. CLion will work with it correctly.

  15. Ilia Lotosh says:

    October 29, 2019

    I’m trying to configure CLion 2019.2.4 to use WSL, but I don’t have WSL listed in the Environment box (only MinGW, Cygwin and Visual Studio). What am I doing wrong?

    (I have WSL installed and I even managed to install CLion inside the WSL and open it using X-Windows)

  16. faruk says:

    November 20, 2019

    I receive this error, everything seems fine on settings. I’m using Debian WSL;

    Process finished with exit code -1073741515 (0xC0000135)

    • Anastasia Kazakova says:

      November 21, 2019

      Could you please contact our support at and attach the IDE log.

  17. Bhavesh says:

    January 3, 2020

    Thanks this works on debian

  18. mitien says:

    January 31, 2020

    is it possible to use windows Clion to run WSL but custom sysroot and toolchain? or at least make WSL cmake alias?

    • Vasily Romanikhin says:

      January 31, 2020

      Could you please elaborate your case.

  19. Anteros says:

    June 6, 2020

    I just have a small question, all the work have been done except this one(when I set the toolchains, it warned me that the WSL GDB version: 9.1, supported versions are 7.8.x-8.3.x), how shoud I switch to a lower version? hope you can help me cope with it…

    • Anastasia Kazakova says:

      June 6, 2020

      You can still use v9.1. Supported versions range means we test with it and no critical issues are present. For 9.1 the integration is still in development (related ticket But that doesn’t limit the version you can actually use, just be aware issues are possible.

      • Anteros says:

        June 7, 2020

        thank you!!!!!!:)

  20. Roman says:

    June 6, 2020

    I got the toolchain to run successfully, but my project has file names incompatible with Windows, so I can’t even check it out from git.

    As a work-around, I put the project on Ubuntu (within wsl), but now CLion gives me a CMake error:

    CMake Error: The source directory “//wsl$/Ubuntu/home/repo_from_git” does not exist.

    • Vasily Romanikhin says:

      June 15, 2020

      Have you tried to checkout sources (within WSL) to /mnt/c/working_dir/repo_from_git and then open it in CLion using regular Windows path C:\\working_dir\repo_from_git ?


Subscribe for updates