cygwin bash
Answered
hi folks, i have:
IntelliJ IDEA 2016.3.2
Build #IU-163.10154.41, built on December 21, 2016
Licensed to _deleted_
JRE: 1.8.0_66-b18 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
on Windows 7 64 bit
i would like run cygwin bash as my terminal, but when in tools i set as a shell path: C:\cygwin\bin\bash.exe --login -i
i raise error "java.io.IOException: Couldn't create a PTY"
when i create a .bat file `bash.bat` and into i include 'C:\cygwin\bin\bash.exe --login -i' and run this .bat file, it works.
why?
Please sign in to leave a comment.
I'm using Git Bash in my IntelliJ and for the path I had to put quotes around the path for it to work.
e.g. "C:\Git\bin\sh.exe" --login -i
Try
"c:\cygwin64\bin\sh.exe" -c "/bin/xhere /bin/bash"
Try "c:\cygwin64\bin\sh" -lic "cd ${OLDPWD-.}; bash"
@Glli80's Answer worked for me! Thanks!
Choosing the path to Cygwin.bat in the root of Cygwin directory as the command worked for me.
For me it was -
c:\software\cygwin\Cygwin.bat
I would like to improve the Glli80's answer (since by default my bash profile was not executed):
"c:\cygwin64\bin\sh" -lic "source ~/.bash_profile; cd ${OLDPWD-.}; bash"
Affkar's answer worked for me. I had to reread his comment to understand it's the root directory of the Cygwin folder (cygwin\Cygwin.bat) not the bin folder (cygwin\bin\Cygwin.bat). His answer also ran all of the profiles correctly.
thnak you for improving Esgorbachev
You'll need to restart Idea so it sees the correct Path, but after that your Terminal Shell will work perfectly.
+1 on Dave's answer.
I was having nothing but problems getting IntelliJ to work with Cygwin + my bashrc + cd to project root.
Cygwin.bat calls `bash --login -i` from the bin directory; however, using `"C:\path\to\cygwin\bin\bash" -li` in IntelliJ would leave me at my home directory (the cd to project root wasn't working). Using the `sh -lic "cd here; bash"` trick to run a command and leave the terminal open was failing completely due to my cd function (pushd not available). Even tried `sh -c "cd here; bash -li". Nothing worked. That is, until I tried Dave's answer. I figured it wouldn't work, since `-li` seems to be important. However, I was so wrong.
My bashrc was processed and the terminal opens to the project root. So simple! Too simple to think it works, but it does.
@Derek White
Thanks Derek, Glad to help out. It seems that every accepted solution out there (including StackExchange) goes with the incorrect "-li" approach. Very frustrating. It was nice to see that IntelliJ code actually behaves correctly when the env (Path) was correctly defined.
@Gill80's answer works great except for paths with spaces. To fix this do:
The additional double quotes will force the environment variable into a single entity even if it has a space.
@Glli80's Answer worked for me! Thanks!
@Mskolaut's answer still fails for me when the path contains spaces. A small tweak got it working for me:
Adding "exec" means that the "sh" process is replaced by "bash", leading to one less process.
`"c:\cygwin64\bin\sh"…` did not load my bash profile. `"c:\cygwin64\bin\bash"…` did. Therefore, this is the command I ended up using:
C:\cygwin64\bin\bash -ilc 'cd -; exec bash'