Using Julia on Git bash

I find windows powershell pretty buggy, and sometimes it breaks when trying to open Vim and the key press - display loop gets messed up.

Git bash has always worked for me when ssh-ing. Is there a step by step guide to making it so that when I click the “Julia” icon in my start menu, it opens up Git bash instead of powershell?

Thank you

Put this into a .bat file:

start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login -i -c "exec julia"
4 Likes

Can you expand a bit? I put it into a .bat file and ran it and nothing seems to have changed.

Oh, sorry. Here goes:
image
I put this batch file on my desktop. When I double-click it opens a git-bash window.
image
The key is to have the Julia executable in my path.

When you say “nothing seems to have changed” you mean Julia comes up in CMD, or does not come up at all?

1 Like

Did you get it to work?

1 Like

NO, it doesn’t work

Sorry to hear that. This definitely works for me: I put the following into start.bat

start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login -i -c "exec julia"

I make sure that when I open cmd and type "%PROGRAMFILES%\Git\bin\sh.exe" I get the bash. Then, in bash I must be able to type julia and get the Julia prompt. Under these conditions things work. What happens on your system?

Edit: The paths need to be set for the above to work. On my system:

2 Likes

Thanks, it works great in Win10 (using Julia 1.5.2 through VS Code).

Necro-posting this thread to show that with Windows Terminal, putting

"%PROGRAMFILES%\Git\bin\sh.exe" --login -i -c "C:/Users/YourName/AppData/Local/Programs/Julia-1.6.1/bin/julia.exe"

in the “Command Line” box in the settings for windows terminal works for me.

The same method works for radian if you use R in that way. Make sure you have unix paths (/ not \) in the second command.

The downside to the .bat file is one cannot provide command line arguments.

And if having julia on your path is already required, then why not launch Git-bash itself and then type julia --project or whatever

I have Git-bash pinned to my taskbar.