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?

20
Avatar
Permanently deleted user

+1

-1
Avatar
Permanently deleted user

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.

9

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

-7
Avatar
Permanently deleted user

Try to use just bash or bash.exe.

-4
Avatar
Permanently deleted user

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

3
Avatar
Permanently deleted user

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.

4

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

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

1
Avatar
Permanently deleted user

This also works though I am on windows 8.1

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

-1

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

change

Path to the project

change 

win username
-1
Avatar
Permanently deleted user

Just put bash.exe on shell path

0
Avatar
Permanently deleted user

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

9

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
5

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

"ubuntu" run bash

or

"ubuntu1604" run bash

or

"ubuntu1804" run bash

1

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
Avatar
Permanently deleted user

Using the command:

wsl

will start your default distro

1
Avatar
Permanently deleted user

Try simply use wsl.exe. It runs your default wsl distro. Moreover it will be start in specified Start directory. Not at distro home directory. Open in terminal also works perfectly in this case.

Windows 10 pro 1909

WSL: Ubuntu

IntelliJ Idea 2019.3.2

9

请先登录再写评论。