How can you use new Bash on Ubuntu on Windows terminal in Webstorm?

I am using Bash on Ubuntu on Windows, and I changed the Shell path in Settings > Tools > Terminal from C:\Windows\System32\cmd.exe to C:\Windows\System32\bash.exe ~. However, I now get the  following error when trying to open a new Terminal tab: java.io.IOException: Couldn't create PTY.

How can you use new Bash on Ubuntu on Windows terminal in Webstorm?

16 comments
Comment actions Permalink

According to this post, the trick is to copy c:\Windows\System32\bash.exe to c:\bash.exe

Then you can change the shell path to simply c:\bash.exe. I can confirm that this works.

8
Comment actions Permalink

Hi there,

You can also try surrounding the path to the executable with double quotes, even if it does not have any spaces in it, e.g. (general example)

"C:\Users\USERNAME\AppData\Local\Programs\Git\bin\sh.exe " –login -i

https://youtrack.jetbrains.com/issue/IDEA-136139

-3
Comment actions Permalink

Try to use just bash or bash.exe.

-2
Comment actions Permalink

Expected behaviour is not about change terminal settings, but run "bash" inside default terminal like windows 10 does.

2
Comment actions Permalink

Make sure you are using the 64 bit version of the IDE. I had this problem with Idea, and it took me a while to figure out that my shortcut was actually launching the 32bit version of the IDE. Once I did this, I could just change cmd.exe to bash.exe and it works.

3
Comment actions Permalink

Working with fish on Webstorm terminal on Windows 10 using 64bit jdk, awesome

"C:\windows\system32\bash.exe" -c fish -cur_console:p

1
Comment actions Permalink

This also works though I am on windows 8.1

"C:\Program Files\Git\bin\sh.exe" -login -i

0
Comment actions Permalink

Setting the terminal to C:\windows\system32\bash.exe works with the major caveat that it doesn't on 32 bits. If you are running a 32 bit IntelliJ, you get that error: Terminal tab: java.io.IOException: Couldn't create PTY. In a modern computer, all 64 bit, by default, the shortcut IntelliJ creates in your start menu is for 32 bit, edit it to point to "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.2\bin\idea64.exe" instead of "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.3.2\bin\idea.exe"

3
Comment actions Permalink

Pupeno's answer is the correct one. You shouldn't have to copy bash.exe out of its default directory. What should be done is Jetbrains should update their installer to install the 64-bit shortcut on 64-bit Windows by default so that this is no longer an issue, especially with the Windows 10 Creators Update fixing the issues in WSL that didn't make it viable as a CLI for devs.

2
Comment actions Permalink

for version phpstorm 2017 (windows 10) settings work!!!

change

Path to the project

change 

win username
0
Comment actions Permalink

Just put bash.exe on shell path

0
Comment actions Permalink

A simpler approach is to call the ubuntu executable directly. In this case, the path would look like:

 

C:\Users\<my_user>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe

6
Comment actions Permalink

Silasm's answer works perfectly. It can be even shortened (at least it works on my setup by default):

Instead of:

C:\Users\<my_user>\AppData\Local\Microsoft\WindowsApps\ubuntu.exe

Just write:
 
 
ubuntu
3
Comment actions Permalink

Depends on your installed WSL package set "Shell path" value:

"ubuntu" run bash

or

"ubuntu1604" run bash

or

"ubuntu1804" run bash

0
Comment actions Permalink

Also make sure "Start Directory" is a directory that resolves in a windows command prompt, vs. one that is specific to WSL. If it is the latter that will prevent the WSL shell from being started in the first place.

0

Please sign in to leave a comment.