Create a gist now

Instantly share code, notes, and snippets.

@mpicker0 /.bashrc
Last active Nov 26, 2017

What would you like to do?
Configuring IntelliJ's terminal to run Cygwin
# Add to your .bashrc so the terminal starts in the project directory
if [[ ${INTELLIJ} == "true" ]]; then
cd ${OLDPWD}
fi
# Note that this works in IntelliJ 14, but not in 16.
# Change the shell path in IntelliJ's Tools > Terminal to:
# C:\cygwin64\bin\env INTELLIJ=true TERM=cygwin C:\cygwin64\bin\bash.exe --login -i
@echo off
set INTELLIJ=true
set TERM=vt100
set PATH="C:\cygwin64\bin";%PATH%
bash --login -i
REM This works in IntelliJ 16
REM Change the shell path in IntelliJ's Tools > Terminal to:
REM C:\path\to\this\script\run_bash.bat

Yomiji commented Jun 27, 2017

I realize this is a bit of an older solution but I ran into an issue recently where installing chere -i -t mintty caused an issue with intellij setup using this configuration. The terminal will instead begin to start in the /home/user directory. To fix it, I had to comment out the .bashrc lines in this solution for the entire "if" statement including the "cd" statement. I then had to remove the "--login" and "-i" from the bash statement in line 6 of the run_bash.bat script.

Tools -> Terminal ->Application settings ->Shell Path: "c:\cygwin64\bin\sh.exe" -c "/bin/xhere /bin/bash"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment