4

Is there a way to update Julia from the command line? I looked through the documentation, but I couldn't find anything.

enter image description here

The Pointer
  • 2,226
  • 7
  • 22
  • 50
  • 2
    See the ongoing discussion here: https://discourse.julialang.org/t/is-there-a-simple-julia-upgrade-command/45691/1 – mbauman Sep 01 '20 at 18:36
  • @MattB. Thanks for that. It looks like it's just better to delete the file and install the updated version manually. – The Pointer Sep 01 '20 at 18:40

1 Answers1

5

I would suggest trying asdf if you are on MacOS, Linux, or Windows Subsystem for Linux (it does not have support for Windows proper, since it works in Linux-type shells). It's a generic tool for handling versions and has a Julia plugin. Once asdf is installed, just do

asdf plugin add julia

to add the julia plugin. Then it's very easy to add a new version of Julia. I don't have 1.4.0 installed on this computer (I do have 1.5.1 installed, which I will switch to later), so I will demonstrate by installing that:

$ asdf install julia 1.4.0
Downloading from:
https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.0-linux-x86_64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 94.3M  100 94.3M    0     0  5241k      0  0:00:18  0:00:18 --:--:-- 5932k

Now that it's installed, I can set it to be the default version:

$ asdf global julia 1.4.0

Then I just run julia:

$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release

Now, if I want to change the version back to 1.5.1, it's very easy:

$ asdf global julia 1.5.1
$ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.5.1 (2020-08-25)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

If you want the latest version, just do asdf install julia latest. And to see all available versions, asdf list all julia. Note that you seem to need to type the patch version number, e.g. asdf install julia 1.5.1, not asdf install julia 1.5.

Eric
  • 426
  • 3
  • 6
  • Hi, I installed `asdf` and ran the code `asdf global julia 1.6.1` and when I run julia, it still runs the previous version. What should I do? – Sarvagya Gupta Jun 19 '21 at 13:30
  • I’m not sure, try `which julia` to see if it’s picking up the asdf version. Maybe you have added `julia` to your PATH some other way and it’s picking that up instead. – Eric Jun 20 '21 at 14:05
  • Hi. yeah, it's not picking up asdf julia path. How can I set julia to asdf path? Because when I check PATH, I can see asdf. So what do you suggest? – Sarvagya Gupta Jun 20 '21 at 15:20
  • sorry, I don't check StackOverflow much so didn't see this. Maybe you've added julia somewhere earlier in the PATH than asdf? Or maybe try something like this: https://stackoverflow.com/questions/53517801/pipenv-not-picking-up-python-version-from-asdf – Eric Jun 26 '21 at 14:34