# Cmdline option/shortcut for activate --temp?

**URL:** <https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956>\
**Category:** General Usage\
**Tags:** pkg, environment\
**Created:** [January 26, 2021, 7:53am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956 "2021-01-26T07:53:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [January 26, 2021, 7:53am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/1 "2021-01-26T07:53:46Z")

</div>

Do we have a command line option to start julia with a temporary environment, instead of having to manually `] activate --temp`? I imagine something like `julia --project=@temp`. If not, what do you think, should we add something like this?

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [January 26, 2021, 8:39am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/2 "2021-01-26T08:39:54Z")

</div>

You can use `julia --project=$(mktemp -d)`.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [January 26, 2021, 8:45am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/3 "2021-01-26T08:45:12Z")

</div>

That’s pretty good, thanks. I guess this won’t work on Windows, will it? Also, it might be somewhat annoying to type compared to what I suggested above.

---

<div class="post-metadata">

**Author:** ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Post date:** [April 7, 2021, 5:11pm UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/4 "2021-04-07T17:11:08Z")

</div>

I agree with [crstnbr](https://discourse.julialang.org/u/crstnbr), it sounds like it would be pretty handy.

---

<div class="post-metadata">

**Author:** ![Lilith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lilith/32/27492_2.png) [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Post date:** [November 17, 2021, 5:19am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/5 "2021-11-17T05:19:15Z")

</div>

If this is something you almost always do, you could add `using Pkg; Pkg.activate(temp=true)` to startup.jl which will make the `julia` command automatically activate a temporary environment. If you want to go back, there is still always `]activate`.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [February 3, 2022, 9:39am UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/6 "2022-02-03T09:39:41Z")

</div>

```bash
alias juliatemp='julia --eval "using Pkg;Pkg.activate(;temp=true)" -i'

```

(But I’d be happier with a `julia --temp`)

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [December 4, 2024, 3:12pm UTC](https://discourse.julialang.org/t/cmdline-option-shortcut-for-activate-temp/53956/7 "2024-12-04T15:12:02Z")

</div>

Necroposting for the benefit of future people searching for this (this thread was the top hit on google for me):

In version 1.12, `julia --project=@temp` will do this (ref [Set temporary env whenever Julia is started with `--project=@temp` by ven-k · Pull Request #51149 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/51149))
