How to run Shell scripts in IDEA via WSL1?

Bash Support Pro does support WSL, but the help doesn’t seem to give any specific configuration options.

I tried the following solution and failed.

Run failed

Manual path conversion

The guess may be related to the path problem, but it still fails after the manual conversion

What’s wrong? I was confused, so I came here for help.

Add more information

By default, msys2 on git bash works normally

Change setting

It still doesn’t work after changing the settings.

Thanks for reporting! WSL is supposed to work, but it seems that there‘s a bug somewhere or that WSL1 is using paths differently compared to WSL2. I‘ll get back to you early next week.

Is there a c:\windows\system32\bash.exe on your system?


This file exists.

@Andy-AO I discovered that there’s a bug with user-defined path mappings in the current version. I’ve fixed that for the next update of 1.5.x, which should be out in about 2 weeks.
The bug is that the mapping strategy defined in the run configuration is not used, the strategy of the application settings is used instead.

Here’s a workaround for now:

  1. Add C:\windows\system32\wsl.exe in the list of interpreters
  2. Set the path mapping to “WSL”
  3. Now run the configuration as in your first screenshot, i.e. with interpreter path C:\Windows\System32\wsl.exe.

Please let me know if this didn’t help or if you need help with anything else.

1 Like

It works fine now. Thank you for your answer.