# How to change the return-value of homedir()

**URL:** https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271
**Category:** New to Julia
**Created:** [September 25, 2020, 3:36pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271 "2020-09-25T15:36:01Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [September 25, 2020, 3:36pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/1 "2020-09-25T15:36:01Z")

</div>

So I want to change the starting location in my file-tree when I use Jupyter. From what I understand, Jupiter opens up the file tree at the location returned by `homedir()`. So my question is, how can I change this value permanently, so that my default location in the file tree when opening Jupyter is wherever I set it to? From the documentation for `homedir()`, I can see that I am supposed to check out “[Miscellaneous utilities — libuv documentation](http://docs.libuv.org/en/v1.x/misc.html#c.uv_os_homedir)”, but that description does not at all help me understand how to change the return-value.

Or, alternativly, some other solution for how to change the default file tree location for Jupyter.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 25, 2020, 3:39pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/2 "2020-09-25T15:39:48Z")

</div>

> [@TheLateKronos](#):
>
> So I want to change the starting location in my file-tree when I use Jupyter.

Do `IJulia.notebook(dir="...some other directory...")`, since it sounds like you are launching Jupyter with `IJulia.jupyter`.

(Or run the `jupyter` program yourself in a terminal, in whatever directory you want.)

---

<div class="post-metadata">

### Author: ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)
#### Post date: [September 25, 2020, 3:48pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/3 "2020-09-25T15:48:32Z")

</div>

If I’m in the directory where the notebook(s) is(are), then the relevant special case of @stevengj 's advice is (`using IJulia` is in my startup.jl file) from the REPL

```julia
julia> notebook(;dir=pwd())

```

which keeps me from having to hunt things down in my file system.

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [September 26, 2020, 8:01am UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/4 "2020-09-26T08:01:45Z")

</div>

> [@stevengj](#):
>
> Do `IJulia.notebook(dir="...some other directory...")` , since it sounds like you are launching Jupyter with `IJulia.jupyter` .

I feel like that is a bit too long a peice of code to write every time, so it does not quite scratch my itch.

> [@ctkelley](#):
>
> If I’m in the directory where the notebook(s) is(are), then the relevant special case of @stevengj 's advice is ( `using IJulia` is in my startup.jl file) from the REPL
> 
> ```julia
> julia> notebook(;dir=pwd())
> 
> ```
> 
> which keeps me from having to hunt things down in my file system.

I don’t want to have `using IJulia` in my startup, as it adds to the startup-time and I will not allways want to use it. Sometimes I just want to open the REPL for some quick one-off calculation.

But here is what I ended up doing, which I am very happy with:  
I have added the following into my .julia/config/startup.jl file:

```julia
function jupyter()
    local jupyter_launch = quote
        using IJulia
        notebook(dir=raw"C:\Users\densb\AllMaStuff\Skule\03_Programming\Julia\Notebooks")
    end
    eval(jupyter_launch)
end

```

This means that I can now just call `jupyter()` in the terminal, and everything launches just perfect 😃

Note: I edited to comand so that I don’t define jupyter\_launch as a global, whoops 😅

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [September 26, 2020, 8:38am UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/5 "2020-09-26T08:38:43Z")

</div>

> [@TheLateKronos](#):
>
> I feel like that is a bit too long a peice of code to write every time, so it does not quite scratch my itch.

Why do you need to type the whole line every time? Type `notebook` and press the up arrow to go back in history, I always use this for IJulia notebooks for exactly this reason

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [September 26, 2020, 1:22pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/6 "2020-09-26T13:22:57Z")

</div>

> [@giordano](#):
>
> Why do you need to type the whole line every time? Type `notebook` and press the up arrow to go back in history, I always use this for IJulia notebooks for exactly this reason

I had no idea! That is pretty neat 😃

However, I like my final solution better, where I don’t have to do `using IJulia` manually, and then the notebook-command, or alternatively add it to my startup.jl file and load it even when I don’t use it. Now I use the `jupyter()` command once in any script to load and launch the notebook with custom launch-settings 🕶

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [September 26, 2020, 1:39pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/7 "2020-09-26T13:39:00Z")

</div>

(How often do you launch Jupyter? I usually leave it running for weeks at a time.)

---

<div class="post-metadata">

### Author: ![TheLateKronos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thelatekronos/32/12824_2.png) [@TheLateKronos](https://discourse.julialang.org/u/TheLateKronos)
#### Post date: [September 26, 2020, 1:49pm UTC](https://discourse.julialang.org/t/how-to-change-the-return-value-of-homedir/47271/8 "2020-09-26T13:49:14Z")

</div>

I am just getting into using Jupyter for day-to-day use, and I did not realize that leaving it for weeks was okay practice. With Pluto, I had to relaunch every time I closed my laptop, which was often. I actually just discovered that Jupiter was running just fine after closing and reopening. But I turn my computer completely off every at least once a day, so fast and convenient launch is pretty important.
