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

**URL:** <https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415>\
**Category:** New to Julia\
**Created:** [January 23, 2023, 5:26pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415 "2023-01-23T17:26:56Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)\
**Post date:** [January 23, 2023, 5:26pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/1 "2023-01-23T17:26:56Z")

</div>

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

In MATLAB, it’s possible to type

```matlab
>> 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
julia> edit("startup.jl")

julia> 

```

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?

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [January 23, 2023, 5:41pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/2 "2023-01-23T17:41:26Z")

</div>

In Linux you would do:

```julia
edit("/home/user/.julia/config/startup.jl")

```

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

---

<div class="post-metadata">

**Author:** ![ianshmean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ianshmean/32/216042_2.png) [@ianshmean](https://discourse.julialang.org/u/ianshmean)\
**Post date:** [January 23, 2023, 5:46pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/3 "2023-01-23T17:46:45Z")

</div>

You can do this but it is an internal function

```julia
julia> edit(Base._local_julia_startup_file())

```

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [January 23, 2023, 5:48pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/4 "2023-01-23T17:48:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)\
**Post date:** [January 23, 2023, 5:49pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/5 "2023-01-23T17:49:15Z")

</div>

That’s an awesome solution; thanks @ianshmean!

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [January 23, 2023, 5:52pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/6 "2023-01-23T17:52:36Z")

</div>

I do see:

> `startup.m` file in the [`userpath`](https://www.mathworks.com/help/matlab/ref/userpath.html) 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.]

---

<div class="post-metadata">

**Author:** ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)\
**Post date:** [January 23, 2023, 5:52pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/7 "2023-01-23T17:52:56Z")

</div>

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

```julia
edit("myfile.jl")

```

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

---

<div class="post-metadata">

**Author:** ![lrnv](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lrnv/32/19373_2.png) [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Post date:** [January 23, 2023, 5:54pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/8 "2023-01-23T17:54:58Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [January 23, 2023, 6:00pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/10 "2023-01-23T18:00:01Z")

</div>

~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?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [January 23, 2023, 6:11pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/11 "2023-01-23T18:11:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![liamh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/liamh/32/208541_2.png) [@liamh](https://discourse.julialang.org/u/liamh)\
**Post date:** [April 18, 2025, 7:58pm UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/12 "2025-04-18T19:58:05Z")

</div>

Apart from the editing aspect, `Base._local_julia_startup_file()` is useful to determine just what startup file it’s reading. In fact it was not stated in the manual [until I fixed it](https://github.com/JuliaLang/julia/pull/58126/commits/7aed19376c204005c52e9f94e4a325f73b1ca956) that if `JULIA_DEPOT_PATH` is set, `startup.jl` is read from there.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 19, 2025, 9:54am UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/13 "2025-04-19T09:54:07Z")

</div>

The main problem is remembering where to look for `startup.jl`, that’s what _I_ need help with, at least. `Base._local_julia_startup_file()` is nice, but I will never remember that.

Having this easily available (and searchable) from the editor/IDE is the right solution, I think.

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [April 19, 2025, 10:00am UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/14 "2025-04-19T10:00:00Z")

</div>

> [@liamh](#):
>
> Base.\_local\_julia\_startup\_file()

This is how to do it on my Mac.  
Use vi on the command line.  
or use joe or even textedit.

```julia
               _
   _ _ _(_)_ | Documentation: https://docs.julialang.org
  (_) | (_) (_) |
   _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 1.11.4 (2025-03-10)
 _/ |\ __'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |

julia> Base._local_julia_startup_file()
"/Users/ssiew/.julia/config/startup.jl"

julia> println("vi $(Base._local_julia_startup_file())")
vi /Users/ssiew/.julia/config/startup.jl

```

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [April 19, 2025, 10:05am UTC](https://discourse.julialang.org/t/how-do-i-open-and-edit-my-startup-jl-file/93415/15 "2025-04-19T10:05:24Z")

</div>

[According to the Julia manual](https://docs.julialang.org/en/v1/manual/command-line-interface/#Startup-file), using any OS search tool, it should be the `startup.jl` that user created under `~/.julia/config`.

Associating the VSCode program with `*.jl` files allows `startup.jl` to be opened in VSC by double-clicking.
