# Can I specify the sysimage inside a Julia file?

**URL:** <https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886>\
**Category:** New to Julia\
**Tags:** sysimage\
**Created:** [July 1, 2019, 7:04am UTC](https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886 "2019-07-01T07:04:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [July 1, 2019, 7:04am UTC](https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886/1 "2019-07-01T07:04:10Z")

</div>

Is it possible to set the parameters of the interpreter by the Julia file which is executed? Maybe something similar to modelines.

I would have two usecases in mind:

Run a script with compile=min to be closer to a script language.

Select a sysimage.

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [July 1, 2019, 11:03am UTC](https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886/2 "2019-07-01T11:03:39Z")

</div>

You can use shebang `#!` syntax but it wouldn’t work on Windows. You may also have to fudge around the single-argument limitation of using shebangs somehow.

---

<div class="post-metadata">

**Author:** ![jpsamaroo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpsamaroo/32/46804_2.png) [@jpsamaroo](https://discourse.julialang.org/u/jpsamaroo)\
**Post date:** [July 1, 2019, 12:05pm UTC](https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886/3 "2019-07-01T12:05:22Z")

</div>

Note that if you’re wondering if you can change the sysimage or interpreter “on the fly” (at runtime), this is not currently possible, especially changing the sysimage (switching to the interpreter _might_ be possible, and if you find out how, please do let me know 🙂).

---

<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:** [July 1, 2019, 12:11pm UTC](https://discourse.julialang.org/t/can-i-specify-the-sysimage-inside-a-julia-file/25886/4 "2019-07-01T12:11:05Z")

</div>

> [@jpsamaroo](#):
>
> You may also have to fudge around the single-argument limitation of using shebangs somehow.

Something I’ve found to work reliably (with bash on Linux) is the following trick:

```julia
#!/bin/bash
#=
exec /path/to/julia --possibly-multiple --julia-options "${BASH_SOURCE[0]}"
=#

println("Hello World!")

```

(you’ll have to adapt this slightly if your script takes arguments)
