# Getting Julia REPL working in Windows git/bash

**URL:** <https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715>\
**Category:** New to Julia\
**Created:** [November 24, 2020, 9:41pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715 "2020-11-24T21:41:01Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 24, 2020, 9:41pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/1 "2020-11-24T21:41:01Z")

</div>

I know one of the common Julia workflows in Windows is to run Julia through MinGW’s bash (popularly available with git):

> [@Using Julia on Git bash](https://discourse.julialang.org/t/using-julia-on-git-bash/24413/7):
>
> 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:

I’m working on a Windows distribution of Julia [GitHub - heetbeet/juliawin: A portable Julia for Windows, bundled with VSCode, Pluto, Conda & PyCall, and more.](https://github.com/heetbeet/juliawin) and was wondering if wrapping julia processes through MinGW should be one of the options, or maybe even the default option considering how posix focused the community is.

But after my first few tests on running this pipeline, I found that the julia REPL gets jammed after calling `run(`ls`)`

 ![image](https://global.discourse-cdn.com/julialang/original/3X/e/b/eb88518af339ae412ccdd2f6a46d2fb1ed5c483e.png)

The same happens from powershell and when running in mintty directly. Can anyone confirm the same on their system?

---

<div class="post-metadata">

**Author:** ![scimas](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@scimas](https://discourse.julialang.org/u/scimas)\
**Post date:** [November 24, 2020, 9:51pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/2 "2020-11-24T21:51:49Z")

</div>

I don’t know what’s going wrong here, but if I run the vanilla julia distribution from bash on windows, it works fine. But if I run julia with winpty, it starts printing similar control characters that you’re seeing.  
That is git bash:

```julia
$ julia
julia> run(`ls`)
.
.
.
Process(`ls`, ProcessExited(0))
julia>

```

works fine. But

```julia
$ winpty julia
julia> run(`ls`)
.
.
.
?[0mProcess(...[some more stuff here]
[some more control characters]julia> [more control characters]

```

breaks. Could be a clue for you to troubleshoot further.

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 24, 2020, 9:57pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/3 "2020-11-24T21:57:47Z")

</div>

Okay that is interesting, my git bash doesn’t even work. What version of git are you on exactly? Mine is:

```julia
$ where git
C:\Program Files\Git\cmd\git.exe

$ git --version
git version 2.27.0.windows.1

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 24, 2020, 10:24pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/4 "2020-11-24T22:24:16Z")

</div>

What I actually do is run the MINGW64 terminal

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/7/57ebe7c9a180257182f4ed3968ae5fa5f07a2e98.png)  
Why do you need to run powershell or cmd and start bash from there?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 24, 2020, 10:28pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/5 "2020-11-24T22:28:14Z")

</div>

I think you might have seen this, but in case you haven’t: [Portable Julia - #6 by PetrKryslUCSD](https://discourse.julialang.org/t/portable-julia/45339/6)

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 25, 2020, 7:42am UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/6 "2020-11-25T07:42:53Z")

</div>

I get the same jumbled text even when in Mintty (MINGW64), so that doesn’t change anything:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/8/08447dfcdcfd4850297dab3613192ef6efeb7dcc.png)

Thanks for the link to your portable julia packaging, will check it out.

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 25, 2020, 7:45am UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/7 "2020-11-25T07:45:36Z")

</div>

Also in shell mode:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/4/c41911afccb4ca591d776891e6650951bdebd03f.png)

I’m gonna install an updated version of git and see if that fixes anything.

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 25, 2020, 7:57am UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/8 "2020-11-25T07:57:45Z")

</div>

Newer version of Git didn’t help, but it seems like the problem occurs in Julia version 1.5.3. I quickly downloaded an arbitrarily old version of Julia and saw that it doesn’t occur in Julia version 1.1.1  
On which version of Julia did you guys test this on?

**Edit** : ran some extra tests

- works on 1.1.1
- works on 1.3.1
- works on 1.4.2
- doesn’t work on 1.5.3 (also tested on an additional newly downloaded version)
- works on 1.6.0-DEV.1564 (2020-11-24)

So whatever it is, it does seem to get fixed somewhere in 1.6

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 25, 2020, 9:08am UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/9 "2020-11-25T09:08:38Z")

</div>

Some further investigation lead me to believe that this doesn’t have anything to do with the shell environment, but with the actual mingw binaries being executed.

For example, if I run a normal Julia session in Windows, then (correctly so) echo doesn’t work, but does work under `cmd /c "echo ..."`. But if I run the echo.exe binary from MinGW directly, then it also leaves my REPL in an unusable state. So in this case its the actual output of the echo.exe binary that does this, not because of any runtime environment shenanigans.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/0/c02de0ed4eeaad75c5f5580ffdf6c8c6ec56e528.png)

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 25, 2020, 3:45pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/10 "2020-11-25T15:45:18Z")

</div>

That is weird. I don’t see anything wrong:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/1/c11f29e3114b26b45b617e449b035feddb994c96.png)

```julia
PKrysl@Spectre MINGW64 ~
$ echo "${BASH_VERSION}"
4.4.23(1)-release

```

Edit: Your example.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/3/a3b9445d38dd58705d3b2d329209efd4db809903.png)

Edit 2: with the latest portable Git.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/8/3/8385d88c458e8aecad312d4b83b5769ff1a8f6f1.png)

---

<div class="post-metadata">

**Author:** ![scimas](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@scimas](https://discourse.julialang.org/u/scimas)\
**Post date:** [November 26, 2020, 7:54pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/11 "2020-11-26T19:54:24Z")

</div>

> [@heetbeet](#):
>
> - works on 1.1.1
> - works on 1.3.1
> - works on 1.4.2
> - doesn’t work on 1.5.3 (also tested on an additional newly downloaded version)
> - works on 1.6.0-DEV.1564 (2020-11-24)

When you say it works on all versions except 1.5.3, are you testing with the official julia distributions or your juliawin distributions? Because I only see a single release on the github page of juliawin and it is not clear which julia version that is.

I personally tested with 1.5.3.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [November 26, 2020, 8:08pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/12 "2020-11-26T20:08:09Z")

</div>

When you tested, what were the results please?

---

<div class="post-metadata">

**Author:** ![heetbeet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heetbeet/32/20958_2.png) [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Post date:** [November 26, 2020, 8:31pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/13 "2020-11-26T20:31:41Z")

</div>

All my tests were with official Julia releases. I found these releases here:

> **[Julia Downloads (Old releases)](https://julialang.org/downloads/oldreleases/)**
>
> The official website for the Julia Language. Julia is a language that is fast, dynamic, easy to use, and open source. Click here to learn more.

I didnt have to install them, I extracted them with universal extractor [Releases · Bioruebe/UniExtract2 · GitHub](https://github.com/Bioruebe/UniExtract2/releases) .

Some of the versions required two rounds of extraction, but is is quite handy in order to get a bunch of portable releases going.

---

<div class="post-metadata">

**Author:** ![scimas](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@scimas](https://discourse.julialang.org/u/scimas)\
**Post date:** [November 26, 2020, 8:50pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/14 "2020-11-26T20:50:25Z")

</div>

It is the first reply in this thread. Everything works well except if I try to use winpty.

> [@Getting Julia REPL working in Windows git/bash](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/2):
>
> I don’t know what’s going wrong here, but if I run the vanilla julia distribution from bash on windows, it works fine. But if I run julia with winpty, it starts printing similar control characters that you’re seeing. That is git bash: $ julia julia\> run(`ls`) . . . Process(`ls`, ProcessExited(0)) julia\> works fine. But $ winpty julia julia\> run(`ls`) . . . ?[0mProcess(...[some more stuff here] [some more control characters]julia\> [more control characters] breaks. Could be a clue for you to …

EDIT: the git version is 2.29.2.windows.1

---

<div class="post-metadata">

**Author:** ![Jorge\_Vieyra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jorge_vieyra/32/6527_2.png) [@Jorge\_Vieyra](https://discourse.julialang.org/u/Jorge_Vieyra)\
**Post date:** [December 1, 2020, 9:37am UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/15 "2020-12-01T09:37:43Z")

</div>

I have the same problem. If I double click and use the default Windows console I have this problem.

However, if I use ConEmu I don’t.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/2/62a9088d79892db1e9cd3c05ce9161ff6ae8eb11.png)

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [December 3, 2020, 10:58pm UTC](https://discourse.julialang.org/t/getting-julia-repl-working-in-windows-git-bash/50715/16 "2020-12-03T22:58:55Z")

</div>

Hello all:

I have now tried this with Sublime Text 4. Julia is run in Terminus, and ST is started in the git bash.  
With 1.5.1 and 1.5.2, shell commands are fine; with 1.5.3 shell commands mess up the Julia prompt.  
1.6 is again fine.
