Launch current version of Julia from the terminal

After installing Julia 1.5, the terminal (Mac OS) still launches v1.4.2.

How can I get it to launch v1.5 ?

use which julia in terminal to figure out why it’s using the old julia; by default julia doesn’t install to your PATH, you you likely added the 1.4.2’s binary at some point

1 Like

Okay, so, I removed the julia alias (and now v1.4.2 does not launch).

I tried to create an alias to the v1.5 (/Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia) and it indicates that “permission is denied” when trying to open it. I don’t think that is the correct way to do it. But I thought I’d try.

I am pretty sure I am going about this the wrong way–the alias icons look differently, the size is wrong : /.

Below, the alias I created is the right-most info window . . .

The following is the correct way. My bad (coming from a Windows background).

alias julia="/Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia"

This is not a very good way to do this. First of all, how did you install Julia? I suggest you use Homebrew to do it. It usually handles this stuff automatically. (brew cask install julia, after installing Homebrew itself.)

Now, to fix your problem correctly, it’s necessary that you understand a few things (which are essential to Unix): dotfiles that configure shells, the PATH variable, and the fact that setting the PATH globally on macOS is hard so most don’t bother.
But to give you a shortcut, your problem can be solved by adding the following code to ~/.zshenv and ~/.bashrc:

addToPATH () {
    export PATH="$1:$PATH"
}
addToPATH /Applications/Julia-1.5.app/Contents/Resources/julia/bin/
1 Like

Is this better ? It seemed to work . . .

ln -fs “/Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia” /usr/local/bin/julia

Yes, that works just fine. /usr/local/bin/ is already in your PATH, so linking there will make the binary discoverable.

1 Like