Running two different versions of Julia simultaneously


I am using julia1.5.2 (on a linux machine) and noticed
that it creates a directory .julia under my home directory
and installs downloaded packages there.

I have installed julia1.6.7 in a different directory to

I want to use julia1.6.7 but suspect that it will install
downloaded packages in the above-mentioned .julia
directory thus overwriting the existing files there.

I would be grateful if you could provide some steps
on how to direct julia1.6.7 to use a different directory
for installing packages, for example, .julia1.6.7

Thank you.

Multiple Julia versions are designed to be able to cooperate in the same depot (.julia) but if you absolutely don’t want them to, you can set the environment variable JULIA_DEPOT_PATH to point elsewhere.

1 Like

They will both write into .julia but they will write into separate parts. For example, I have

ls ~/.julia/environments/
v1.10/ v1.11/ v1.6/  v1.7/  v1.8/  v1.9/

Also, any specific reason you’re still using 1.5.2? That’s a pretty out of date version (so is 1.6.7, but that is an LTS which makes it a little more understandable).


As you suggest, I can set the environment variable JULIA_DEPOT_PATH to the directory /home/…/.julia1.6.7

But then, how will I direct julia1.5.2 to use .julia and julia1.6.7 to use .julia1.6.7?

No problem at all to install any number of Julia versions in parallel. I have a run_julia script per project, and use
jill switch 1.9
julia --project
or whatever version is needed for the current project to activate the correct julia version. You can achieve the same result with juliaup, just the command is different.

No need for changing JULIA_DEPOT_PATH… Don’t do it.

1 Like

There are many ways to arrange that but for example you can create a shell alias something like

alias julia1.6.7='JULIA_DEPOT_PATH=/home/.../.julia1.6.7 /path/to/julia1.6.7'

There are valid reasons to use separate depots although I suspect that it’s overly conservative in this case. I use two depots myself to handle two completely separate environments with different private registries and different package servers.

Well, this are valid reasons to use different depot paths, but if you just need different Julia versions per project there is no reason to use them.

Honestly think twice before doing this - messing with the load path is more of an advanced use case. Fwiw I’ve been using Julia since 0.3 and have every version from 0.6 to 1.10beta2 installed on my current machine, all with a single .julia directory and without any load path shenanigans.