# Why isn't "\]" pastable into the julia REPL

**URL:** <https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817>\
**Category:** General Usage\
**Tags:** repl, pkg\
**Created:** [April 7, 2025, 8:00pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817 "2025-04-07T20:00:05Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bart\_van\_de\_Lint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bart_van_de_lint/32/212161_2.png) [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Post date:** [April 7, 2025, 8:00pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/1 "2025-04-07T20:00:05Z")

</div>

Normally, when writing `]` in the julia REPL, you go into `pkg>`. But when pasting a line starting with `]` in the REPL, it just shows as text.

Writing `]` manually:

```julia
(@v1.11) pkg> 

```

Pasting `]`:

```julia
julia> ]

```

Is there a reason for this, or is this a bug?

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [April 7, 2025, 9:39pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/2 "2025-04-07T21:39:22Z")

</div>

Works for me, check the version and platform?

```julia
julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68 (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, icelake-client)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

(@v1.11) pkg> # pasted ] before comment

```

---

<div class="post-metadata">

**Author:** ![Bart\_van\_de\_Lint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bart_van_de_lint/32/212161_2.png) [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Post date:** [April 8, 2025, 12:00pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/3 "2025-04-08T12:00:50Z")

</div>

Maybe it is a problem on Linux?

```julia
bart@BartsPC ~ % lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble
bart@BartsPC ~ % julia
julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  LD_LIBRARY_PATH = /usr/local/cuda-12.2/lib64

julia> ] # pasted
ERROR: ParseError:
# Error @ REPL[2]:1:1
] # pasted
╙ ── unexpected `]`
Stacktrace:
 [1] top-level scope
   @ none:1

```

---

<div class="post-metadata">

**Author:** ![mihrits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mihrits/32/34494_2.png) [@mihrits](https://discourse.julialang.org/u/mihrits)\
**Post date:** [April 8, 2025, 1:33pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/4 "2025-04-08T13:33:16Z")

</div>

Pasting doesn’t change the repl mode on macOS with wezterm.

```julia
julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 8 × Apple M1 Pro
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)
Environment:
  JULIA_EDITOR = lvim

```

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 8, 2025, 1:42pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/5 "2025-04-08T13:42:15Z")

</div>

Nor on Ubuntu in WSL2 in Windows (WezTermn)

It does work in regular WezTerm on Win 11.

---

<div class="post-metadata">

**Author:** ![Bart\_van\_de\_Lint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bart_van_de_lint/32/212161_2.png) [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Post date:** [April 8, 2025, 2:09pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/6 "2025-04-08T14:09:11Z")

</div>

I submitted an issue to JuliaLang, as it seems to be a bug: [Pasting "]" into the Julia REPL is inconsistent across platforms · Issue #58041 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/58041)

---

<div class="post-metadata">

**Author:** ![Bart\_van\_de\_Lint](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bart_van_de_lint/32/212161_2.png) [@Bart\_van\_de\_Lint](https://discourse.julialang.org/u/Bart_van_de_Lint)\
**Post date:** [April 8, 2025, 2:29pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/7 "2025-04-08T14:29:26Z")

</div>

This is intended, and users should paste `pkg> ` instead.

> <https://github.com/JuliaLang/julia/issues/58041#issuecomment-2786605494>
>
> Pasting \`\]\` into the Julia REPL on Ubuntu and MacOS doesn't make the user go int…o the \`pkg\>\` REPL mode, while it does work on Windows. See this \[discussion\](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817).
> 
> Windows (works):
> \`\`\`
> julia\> versioninfo()
> Julia Version 1.11.4
> Commit 8561cc3d68 (2025-03-10 11:36 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: Windows (x86\_64-w64-mingw32)
> CPU: 8 × Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
> WORD\_SIZE: 64
> LLVM: libLLVM-16.0.6 (ORCJIT, icelake-client)
> Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
> 
> (@v1.11) pkg\> # pasted \] before comment
> \`\`\`
> 
> Ubuntu (doesn't work):
> \`\`\`
> bart@BartsPC ~ % lsb\_release -a
> Distributor ID: Ubuntu
> Description: Ubuntu 24.04.2 LTS
> Release: 24.04
> Codename: noble
> bart@BartsPC ~ % julia
> julia\> versioninfo()
> Julia Version 1.11.4
> Commit 8561cc3d68d (2025-03-10 11:36 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: Linux (x86\_64-linux-gnu)
> CPU: 16 × Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
> WORD\_SIZE: 64
> LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
> Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
> Environment:
> LD\_LIBRARY\_PATH = /usr/local/cuda-12.2/lib64
> 
> julia\> \] # pasted
> ERROR: ParseError:
> \# Error @ REPL\[2\]:1:1
> \] # pasted
> ╙ ── unexpected \`\]\`
> Stacktrace:
> \[1\] top-level scope
> @ none:1
> \`\`\`
> 
> macOS (doesn't work):
> \`\`\`
> julia\> versioninfo()
> Julia Version 1.11.4
> Commit 8561cc3d68d (2025-03-10 11:36 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: macOS (arm64-apple-darwin24.0.0)
> CPU: 8 × Apple M1 Pro
> WORD\_SIZE: 64
> LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
> Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)
> Environment:
> JULIA\_EDITOR = lvim
> \`\`\`

---

<div class="post-metadata">

**Author:** ![sgaure](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sgaure/32/14779_2.png) [@sgaure](https://discourse.julialang.org/u/sgaure)\
**Post date:** [April 8, 2025, 8:36pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/8 "2025-04-08T20:36:29Z")

</div>

The idea is that you can copy-paste whole julia-examples with prompts, output, and all, to replicate them. You can e.g. copy-paste the below example wholesale, and see what it does in your julia session.

```julia
julia> versioninfo()
Julia version 1.11.4
...
(@v1.11) pkg> status
Status `~/.julia/environments/v1.11/Project.toml`
...
shell> date
ti. 08. april 22:34:22 +0200 2025
julia> pwd()

```

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [April 8, 2025, 9:21pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/9 "2025-04-08T21:21:44Z")

</div>

This doesn’t do what I expected (Ubuntu 24.04, Alacritty terminal):

Pasting this text:

```julia
julia> versioninfo()

(@v1.11) pkg> status

shell> date

julia> pwd()

```

Produces this output:

```julia
julia> versioninfo()
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × AMD Ryzen 9 9950X 16-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, generic)
Threads: 32 default, 0 interactive, 16 GC (on 32 virtual cores)
Environment:
  JULIA_NUM_THREADS = auto
  JULIA_REVISE_INCLUDE = 1

julia> pwd()
"/home/user"

```

The `pkg` and `shell` lines are just ignored, shouldn’t they be processed too?

---

<div class="post-metadata">

**Author:** ![Keno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/keno/32/285_2.png) [@Keno](https://discourse.julialang.org/u/Keno)\
**Post date:** [April 8, 2025, 9:26pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/10 "2025-04-08T21:26:16Z")

</div>

> [@contradict](#):
>
> The `pkg` and `shell` lines are just ignored, shouldn’t they be processed too?

Yes - possibly some bug with your terminal. Works fine for me:

```julia
julia> versioninfo()
Julia Version 1.12.0-DEV.1748
Commit 582585bfb0* (2024-12-11 21:59 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin23.5.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

(@v1.12) pkg> status

shell> date
Tue Apr 8 17:25:29 EDT 2025

julia> pwd()
"/Users/keno"

```

---

<div class="post-metadata">

**Author:** ![danielwe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielwe/32/35657_2.png) [@danielwe](https://discourse.julialang.org/u/danielwe)\
**Post date:** [April 9, 2025, 3:55am UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/11 "2025-04-09T03:55:58Z")

</div>

> [@contradict](#):
>
> Pasting this text:
> 
> ```julia
> julia> versioninfo()
> 
> (@v1.11) pkg> status
> 
> shell> date
> 
> julia> pwd()
> 
> ```

I don’t know why it didn’t work for you, I’m just chiming in to note that you don’t have to sanitize the copy-paste by removing output like this. You should be able to copy @sgaure’s code block verbatim, including the output and `...`, and paste it into your own Julia REPL. The REPL will do all the sanitizing for you.

But for me the sanitized version you provided also works, so there’s probably an issue with your setup.

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [April 9, 2025, 12:11pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/12 "2025-04-09T12:11:34Z")

</div>

> [@contradict](#):
>
> The `pkg` and `shell` lines are just ignored, shouldn’t they be processed too?

I observe the same under GNOME terminal, konsole, terminator in both Arch Linux and Ubuntu and Julia 1.11.

In 1.12 I see:

```julia
julia> versioninfo()
Julia Version 1.12.0-beta1
Commit c175ace780d (2025-04-02 11:19 UTC)
Build Info:
  Official https://julialang.org release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × AMD Ryzen 9 5900X 12-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-18.1.7 (ORCJIT, znver3)
  GC: Built with stock GC
Threads: 24 default, 1 interactive, 24 GC (on 24 virtual cores)
Environment:
  JULIA_NUM_THREADS = 24
  JULIA_MAX_NUM_PRECOMPILE_FILES = 100

(@v1.12) pkg> status

SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching stacktrace(::MethodError)
The function `stacktrace` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  stacktrace(::Bool)
   @ Base stacktraces.jl:202
  stacktrace()
   @ Base stacktraces.jl:202
  stacktrace(::Vector{<:Union{Ptr{Nothing}, Base.InterpreterIP}}, ::Bool)
   @ Base stacktraces.jl:189
  ...

Stacktrace:
  [1] scrub_repl_backtrace(bt::MethodError)
    @ Base ./client.jl:101
  [2] print_response(errio::IO, response::Any, backend::Union{Nothing, REPL.REPLBackendRef}, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:580
  [3] (::REPL.var"#print_response##0#print_response##1"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:556
  [4] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:829
  [5] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:554
  [6] (::REPL.var"#do_respond#73"{Bool, Bool, REPL.var"#setup_interface##4#setup_interface##5", REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1186
  [7] (::REPL.var"#setup_interface##32#setup_interface##33"{…})(::REPL.LineEdit.MIState, ::Any, ::Vararg{…})
    @ REPL ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/REPL.jl:1593
  [8] (::REPL.LineEdit.var"#match_input##0#match_input##1"{REPL.var"#setup_interface##32#setup_interface##33"{…}, String})(s::Any, p::Any)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:1808
  [9] (::REPL.LineEdit.var"#299#300")(s::REPL.LineEdit.MIState, data::REPL.LineEdit.ModeState, c::Union{Char, SubString{String}, String})
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2711
 [10] (::REPL.LineEdit.var"#match_input##0#match_input##1"{REPL.LineEdit.var"#299#300", String})(s::Any, p::Any)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:1808
 [11] macro expansion
    @ ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2958 [inlined]
 [12] macro expansion
    @ ./lock.jl:376 [inlined]
 [13] (::REPL.LineEdit.var"#prompt!##2#prompt!##3"{REPL.Terminals.TTYTerminal, REPL.LineEdit.ModalInterface, REPL.LineEdit.MIState, REPL.LineEdit.Prompt})()
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.12.0-beta1+0.x64.linux.gnu/share/julia/stdlib/v1.12/REPL/src/LineEdit.jl:2947
Some type information was truncated. Use `show(err)` to see complete types.

shell> date
Mi 09 Apr 2025 14:15:31 CEST

julia> pwd()
"/home/felix"
``
```

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [April 9, 2025, 3:20pm UTC](https://discourse.julialang.org/t/why-isnt-pastable-into-the-julia-repl/127817/13 "2025-04-09T15:20:54Z")

</div>

Ah, I figured it out. Removing `OhMyREPL` from my startup script restored the behavior everyone else sees, including the error under 1.12.

Edit:  
Already reported here: [Prompt pasting based on REPL mode · Issue #84 · KristofferC/OhMyREPL.jl · GitHub](https://github.com/KristofferC/OhMyREPL.jl/issues/84)
