How do I open and edit my startup.jl file?

Simple question: How do I open my startup.jl file?

In MATLAB, it’s possible to type

>> edit("startup.m")

and if startup.m already exists, the file opens and becomes editable. If startup.m doesn’t exist, MATLAB asks if I want to create a file by that name.

In Julia, a similar approach silently fails:

julia> edit("startup.jl")


No file opens, and no messages appear to let me know if the file even exists. So how do I open and edit my startup.jl file?

1 Like

In Linux you would do:


but I agree that it would be handy to have a shortcut for that.

1 Like

You can do this but it is an internal function

julia> edit(Base._local_julia_startup_file())

These alternatives are good, but it seems weird to me to expect that specific random bit of functionality to translate from matlab to julia, no?


That’s an awesome solution; thanks @ianshmean!

I do see:

startup.m file in the userpath folder, which is on the MATLAB search path.

It’s sort of understandable then that edit searched in the MATLAB search path, just as when it loads a file. But Julia doesn’t have a search path (for include and I feel edit should be consistent with that). I think having it is a misfeature in MATLAB.

[And while the startup.jl file is useful, for stuff to run before you hit the REPL, my view is it should be off by default for scripts. In case you’re thinking of that, I think it’s an anti-pattern to rely on something there, because then your script will not work the same for the next user.

I proposed changing the Julia default for scripts (also to not slow down benchmarking, you need to remember to add --startup-file=no), way back, but got shot down.]

My expectation is less about the specific startup.jl file, and more about general behavior. If any random myfile.jl exists in a directory where Julia knows to look, then I’d expect


to open the file. If myfile.jl doesn’t exist, I’d expect some sort of error message, rather than silent failing.

Several packages might have the same file names (and several probably do). What you are asking for is better handled by your operating system (finding a file).

~I do not know what did I do with my previous attempt to post this so I am writing this so that discourse does not complain.~

Ah! Yes, I think it should tell you why it failed but it may have to do more with the editor than with the REPL.

I just tried in 1.8.5 and it started editing the file in the current working directory although it did not exist (this seems like the sensible behavior, as opposed to opening ~/.startup.jl). I think this is the behavior of my editor (emacs). So if your ENV["EDITOR"] refuses to do the operation it just exits and julia does not seem to care about the reason it exited.

Just for the curiosity, if you try to edit a nonexistent file with your ENV["EDITOR"] does it refuse?


This seems like something that belongs in either InteractiveUtils, or in editor tooling. I just tested in VS Code, and I couldn’t find any “Open startup.jl” in the menu.

1 Like