Hi. Trying to add Julia to the PATH on my Mac Book Pro.

Thanks.

What are you expecting? Does julia not work after a restart of the terminal?
What is ls $PATH/TO/JULIA?

Actually this PATH worked, just had to start a new terminal tab.

My goal was to be able to access the Julia interpreter from anywhere and not just have to launch the program directly only.

Hi Paul, glad you figured it out! If (when) you have a questions in the future, please take a few minutes to read this post to make it easier for folks. In particular, copying and pasting the text rather than providing a screenshot is typically preferred.

Happy coding!

1 Like

On a mac this is the easiest way

from Introducing Julia/Getting started - Wikibooks, open books for an open world

A different approach is to create a link to the executable and put it into the /usr/local/bin directory (which should already be in your path), so that typing julia is the exact equivalent of typing /Applications/Julia/.../julia . This command does that:

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

replace “Julia-1.0” with the version of Julia you wish to run

COPIED FROM AN OLDER POST BELOW

Probably the easiest way is to issue a similar command like the one below in the MacOS terminal

ln -fs "/Applications/Julia-1.0.app/Contents/Resources/julia/bin/julia" /usr/local/bin/julia

Remember I said SIMILAR, you need to double check the location of julia first in the /Application folder

This is what I have on my Mac

$ which julia
/usr/local/bin/julia
$ ls -l /usr/local/bin/julia*
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia -> /Applications/Julia-1.0.app/Contents/Resources/julia/bin/julia
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia06 -> /Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia07 -> /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia
$ 

postscript: I have not installed Julia 1.1 on my system so I have no clue where the binary for julia is located on the /Application folder for version 1.1 perhaps someone who has installed it can let you know the exact location.

2 Likes

What "ln -fs stand for / do ?

LN(1)                     BSD General Commands Manual                    LN(1)

NAME
     link, ln -- make links

SYNOPSIS
     ln [-Ffhinsv] source_file [target_file]
     ln [-Ffhinsv] source_file ... target_dir
     link source_file target_file

DESCRIPTION
     The ln utility creates a new directory entry (linked file) which has the
     same modes as the original file.  It is useful for maintaining multiple
     copies of a file in many places at once without using up storage for the
     ``copies''; instead, a link ``points'' to the original copy.  There are
     two types of links; hard links and symbolic links.  How a link ``points''
     to a file is one of the differences between a hard and symbolic link.

     The options are as follows:

     -f    If the target file already exists, then unlink it so that the link
           may occur.  (The -f option overrides any previous -i options.)

     -s    Create a symbolic link.

This is what I currently have on my Mac machine

$ ls -l /usr/local/bin/ju*
lrwxr-xr-x  1 ssiew  admin  62 13 Apr 09:07 /usr/local/bin/julia -> /Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia06 -> /Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia07 -> /Applications/Julia-0.7.app/Contents/Resources/julia/bin/julia
lrwxr-xr-x  1 ssiew  admin  62 22 Sep  2018 /usr/local/bin/julia10 -> /Applications/Julia-1.0.app/Contents/Resources/julia/bin/julia