# Automatic package update in startup.jl

**URL:** <https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146>\
**Category:** Package Management\
**Tags:** question\
**Created:** [March 11, 2026, 11:55am UTC](https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146 "2026-03-11T11:55:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [March 11, 2026, 11:55am UTC](https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146/1 "2026-03-11T11:55:25Z")

</div>

Thanks to stacked environments, I only have two packages in my global environment: Revise.jl and EmacsVterm.jl.

I am wondering if there is a way to keep them automatically updated without (significant) user intervention. I could put a

```julia-auto
import Pkg
Pkg.update()

```

in my `startup.jl`, but that would add a significant delay to every time I start up Julia.

Is there a simple way to

1. check if I am online (other than the standard tricks, eg calling `nslookup` with a short timeout)

2. query last time an environment was updated?

---

<div class="post-metadata">

**Author:** ![favba](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/favba/32/2735_2.png) [@favba](https://discourse.julialang.org/u/favba)\
**Post date:** [March 11, 2026, 2:32pm UTC](https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146/2 "2026-03-11T14:32:45Z")

</div>

Would

```julia-auto
import Pkg
if isinteractive()
    Threads.@spawn Pkg.update()
end

```

In the `startup.jl` work for you?  
It would try to update in the background every time you spawn an interactive process.

---

<div class="post-metadata">

**Author:** ![ffevotte](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffevotte/32/6587_2.png) [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Post date:** [March 12, 2026, 8:46am UTC](https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146/3 "2026-03-12T08:46:12Z")

</div>

An other approach could be to have a daily (ana)cron\[1\] job that tries to perform the update. Maybe you don’t even have to check whether you’re online or not: since in this case it would be a non-interactive process, I think you can afford to let it fail silently when you’re offline; it will still fulfill its purpose if it succeeds at least every few days.

* * *

1. or any similar tool depending on your OS

---

<div class="post-metadata">

**Author:** ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)\
**Post date:** [March 12, 2026, 9:05am UTC](https://discourse.julialang.org/t/automatic-package-update-in-startup-jl/136146/4 "2026-03-12T09:05:24Z")

</div>

The other options are nice. However, I do think it is good to update each time.

If you want to update, I have a small script to update periodically the julia version and all shared environment, but I only run one time after several weeks, this is:

```sh
#!/usr/bin/env bash
juliaup update
cd ~/.julia/environments || exit

for dir in *; do
    if ! [-d "$dir"]; then
       continue
    fi

    cd "$dir" || continue
    julia -e 'using Pkg; Pkg.activate("."); Pkg.update(); Pkg.gc()'
    cd ..
done

```

As I said, it is very slow, so I usually put when I am working on other things, not with Julia :-).
