# How to update packages and create a system image

**URL:** <https://discourse.julialang.org/t/how-to-update-packages-and-create-a-system-image/62229>\
**Category:** General Usage\
**Tags:** question\
**Created:** [June 1, 2021, 8:57pm UTC](https://discourse.julialang.org/t/how-to-update-packages-and-create-a-system-image/62229 "2021-06-01T20:57:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [June 1, 2021, 8:57pm UTC](https://discourse.julialang.org/t/how-to-update-packages-and-create-a-system-image/62229/1 "2021-06-01T20:57:28Z")

</div>

Hello,

I am using a bash script to create a new system image when the source code, in particular the set of used packages of my project has changed (after git pull).

The core are the following three lines:

```nohighlight
rm -f Manifest.toml
julia --project -e "include(\"./test/update_packages.jl\");"
julia --project -e "using Pkg; Pkg.precompile()"
julia --project -e "include(\"./test/create_sys_image.jl\");"

```

This is the content of the file update\_packages.jl:

```julia
@info "Updating packages ..."
using Pkg
Pkg.instantiate()
Pkg.update()
Pkg.precompile()

```

Explanation:

1. I need to delete Manifest.toml, because in the git repository the content  
of Project.toml sometimes changes, and I get an error message if new packages  
are added if I do not delete Manifest.toml
2. The update\_packages.jl script sometimes fails with the message:  
“Not all packages could be precompiled. Please restart Julia and try again…”  
The third line of the bash script is doing that.
3. This is the main script to create a new system image. Before executing it I  
want to be sure that all packages are up-to-date.

While this works fine, I wonder if there is a way to achieve the same goal without  
using bash, because bash might not be available on Windows or Mac.

Any ideas how to do that in pure Julia?

I think this kind of functionality should become part of base.

Uwe

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [June 1, 2021, 11:48pm UTC](https://discourse.julialang.org/t/how-to-update-packages-and-create-a-system-image/62229/2 "2021-06-01T23:48:12Z")

</div>

Hmmm, would it possible to spawn a background session of Julia and run the code in that session using `@spawn`? So you can run this in Julia. Not sure, just an idea.

Also, if the windows is controlled by you, you can easily install some kind of bash like git-bash on it then this will work. I see some programs have a .bat file just for windows so on windows the .bat file is invoked instead or something.
