Setup Clion to WSL Rust


How do I setup the CLion Rust pluggin to use WSL (Ubuntu) Rust instead of Windows Rust (I have both installed). I have CLion setup to use WSL for C/C++ and that all works but when I try to point CLion to the location where WSL install GNU Cargo it says it can't find Cargo (even though I'm looking at it in an Explorer window).



Using the Rust plugin with a toolchain in WSL is not supported yet. Please follow


Anna Falevskaya Thanks for the reply. What is the supported debug path for Windows then? The doc for IntelliJ-Rust shows someone setting up a Mac. Is it Cygwin, mingw, mingw64...? And is there any doc for doing the setup on Windows?

Thanks again.


You can set either Cygwin or MinGW as your working environment. Here is a detailed blog post about debugging Rust Code in CLion:


Using Windows CLion to work on linux/GNU rust projects under WSL now works (at least for me).

I'm adding this comment as this is the top search result in google when looking for "clion wsl rust".

These instructions are for CLion 2021.2.1, from this change-log :

Basically, just turn on the experimental option `org.rust.wsl` (you can search actions for 'experimental features" to find the list of options).

You need to install rust in wsl, like any Linux distro.

Then just change up your rust toolchain location (setting->Languages & Frameworks->Rust) to point to your WSL toolchain. It should be someplace like: \\wls$\Ubuntu\home\user-name\.cargo\bin` . The standard library path should auto-update if you've set the toolchain root correctly.

That's about it.

You know it's working when you run something and the first cmd in the output window is something like `C:\Windows\system32\wsl.exe`

Now you can leave all your projects inside \\$wsl and use all the standard linux/GNU tools and libraries. You can even delete/remove your windows rust install.




Please sign in to leave a comment.