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?
You can use julia --project=$(mktemp -d)
.
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.
I agree with crstnbr, it sounds like it would be pretty handy.
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
.
alias juliatemp='julia --eval "using Pkg;Pkg.activate(;temp=true)" -i'
(But I’d be happier with a julia --temp
)
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)