# How do you make standalone programs in Julia?

**URL:** <https://discourse.julialang.org/t/how-do-you-make-standalone-programs-in-julia/105218>\
**Category:** General Usage\
**Tags:** question\
**Created:** [October 20, 2023, 7:20am UTC](https://discourse.julialang.org/t/how-do-you-make-standalone-programs-in-julia/105218 "2023-10-20T07:20:24Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![anon91151494](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@anon91151494](https://discourse.julialang.org/u/anon91151494)\
**Post date:** [October 14, 2024, 8:10am UTC](https://discourse.julialang.org/t/how-do-you-make-standalone-programs-in-julia/105218/22 "2024-10-14T08:10:57Z")

</div>

> [@jules](#):
>
> otherwise you do not get the same behavior

Sorry, just to confirm, which behavior is this you refer to here? I didn’t fully understand this.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 14, 2024, 8:16am UTC](https://discourse.julialang.org/t/how-do-you-make-standalone-programs-in-julia/105218/23 "2024-10-14T08:16:29Z")

</div>

The feature described on the docs page you linked to:

> As of Julia, 1.11, `Base` exports the macro `@main`. This macro expands to the symbol `main`, but **at the conclusion of executing a script or expression, `julia` will attempt to execute the function `Main.main(ARGS)` if such a function has been defined and this behavior was opted into by using the `@main` macro**.

You were asking what the difference between `Main.main` and `@main` is and I said, `@main` resolves to `Main.main` so in that sense they’re the same, but it also writes this hidden variable which is what enables the quoted behavior. If you just have a function called `main` in your `Main` module then nothing special happens if you run that script. But if you have a `@main` somewhere then Julia will execute that function.

[Previous page](https://discourse.julialang.org/t/how-do-you-make-standalone-programs-in-julia/105218.md?page=1)
