How to change "julia>" prompt to ">" in console and vscode?

And hide Julia initial info too, so the repl will be nice and clean.

1 Like
# Set the prompt using environment variable
ENV["JULIA_PROMPT"] = "> "

# Also try the REPL approach as backup
using REPL

if isinteractive()
    atreplinit() do repl
        try
            repl.interface = REPL.setup_interface(repl)
            repl.interface.modes[1].prompt = "> "
        catch
            # If this fails, the environment variable should still work
        end
    end
end
  1. Shell environment variable: JULIA_PROMPT="> " in your ~/.zshrc

  2. Alias for splash screen: julia --quiet --banner=no

4 Likes

Thanks, I tried JULIA_PROMPT but seems like it doesn’t work? (the second approach doesn’t work ether).

bash> echo $JULIA_PROMPT     
> 
bash> julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.4 (2025-03-10)
 _/ |\__'_|_|_|\__'_|  |  Built by Homebrew (v1.11.4)
|__/                   |

julia> "Hi"
"Hi"

julia> ENV["JULIA_PROMPT"] = "> "
"> "

julia> "Hi"
"Hi"

julia>

That’s because dummy here left out the part of the startup.jl file

# Set the prompt using environment variable
ENV["JULIA_PROMPT"] = "> "

# Also try the REPL approach as backup
using REPL

if isinteractive()
    atreplinit() do repl
        try
            repl.interface = REPL.setup_interface(repl)
            repl.interface.modes[1].prompt = "> "
        catch
            # If this fails, the environment variable should still work
        end
    end
end

This goes in your ~/.julia/config directory

3 Likes

Home · OhMyREPL does that plus a bunch more.

3 Likes

Thanks, adding it to ~/.julia/config/startup.jl solved the prmpt.

As for removing the banner - isn’t there any config/env option to supress it? adding --quiet is not convenient

3 Likes

Didn’t find one, but

alias julia="julia --quiet  --banner=no"

in .zshrc is a problem?

2 Likes

Thanks, yes that’s reasonable solution.

1 Like

To add on to @Joris_Pinkse, changing the prompt is a dedicated example as well.

OhMyREPL.input_prompt!("> ", :magenta)
OhMyREPL.output_prompt!("> ", :red)

Additionally,

If the first argument instead is a function, it will be run every time the prompt wants to update which allows for more dynamic behavior.

2 Likes