CLion 2019.3 Help


WSL (WSL 2) - Windows Subsystem for Linux - is a compatibility layer for running Linux binary executables natively on Windows 10. Currently, it supports several Linux distributions, such as Ubuntu, OpenSUSE, and SLES.

With WSL toolchain set up for your project, you can build using CMake and compilers from Linux, and run/debug on WSL, without leaving CLion running on your Windows machine.

Configure WSL

  1. Download and install WSL distribution (for instance, Ubuntu) from Microsoft Store.

    For this step, be sure to use Windows 10 with the latest “Fall Creators Update” (minimum version 1709, build 16299.15). See the official guide Install the Windows Subsystem for Linux for instructions.

    To work with WSL 2, your Windows version should be 10 build 18917 or later. Follow these instructions to switch the distributive.

    Note that CLion does not support legacy WSL, which you may have installed before upgrading your system to the build 16299.15 or later of Windows 10. In this case, you need to update your WSL distribution.

  2. Run Ubuntu.

    Upon the first launch of Ubuntu, the system may prompt you to enable the Windows optional feature. In this case, you need to:

    • Open Windows Power Shell as Administrator and run

      Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

    • Restart your computer.

  3. Set up the WSL Ubuntu environment:

    • Install cmake, gcc, or/and clang (and optionally build-essentials package), as follows:

      sudo apt-get install cmake gcc clang gdb build-essential

    • Configure and run open ssh-server.

      You can set the configuration manually or by using our script (note that if your Linux distribution is different from Ubuntu, the script might need adjustments). To download and run the script, use the following command line:

      wget && bash

  4. Next, check the ssh connection:

    ssh username@localhost -p2222

    Port number 2222 is valid for our configuration script. If you are not using our script, the port number can be different.

If you have upgraded a previously configured WSL to WSL 2, you need to bind your application to instead of (see User Experience Changes Between WSL 1 and WSL 2):

  • 1) Open /etc/ssh/sshd_config as sudo.

  • 2) In the ListenAddress line, replace with

  • 3) Save the changes and run sudo service ssh restart.

Configure a WSL toolchain for your project

  1. In CLion, go to Settings / Preferences | Build, Execution, Deployment | Toolchains and click plus icon to create a new toolchain. Select WSL from the Environment list. CLion automatically detects the installed distribution, or you can set the path manually.

    Provide the remote credentials (in case of unexpected errors, try the troubleshooting instructions):

    WSL toolchain

  2. Now to start using the toolchain, do one of the following:

    • Set the WSL toolchain as default. This way, it will automatically connect to the default CMake profile.

    • Create a separate CMake profile, connect it to the WSL toolchain, and select this profile in the configurations switcher:

      cmake profile for wsl toolchain


  • Make sure that two bundled plugins, FTP/SFTP Connectivity and Remote Hosts Data Access, are enabled in Settings / Preferences | Plugins.

  • If you get the Credentials are not valid for this WSL distribution error when creating a toolchain, check the value of HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss{ubuntu_id }\BasePath in the Windows Registry Editor (to access it, launch regedit from the Start menu). In case the value contains non-ASCII characters, use the workaround described in this issue.

  • Due to the IntelliJ platform issue, there are problems with using WSL file-system which is case-sensitive and Windows file system which is not. As a workaround, you can do the following:

    • Go to Help | Edit Custom properties... menu option and specify

    • Invalidate caches and restart the IDE using File | Invalidate Caches and Restart menu option.

Last modified: 20 February 2020