Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the Julia init path on Mac?

I have the Julia application on my Mac as follows:

$ alias julia
alias julia='exec '\''/Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia'\'''

I'd like to be able to call Julia from Python (or a Jupyter/IPython notebook):

from julia import Julia

However, in the next step, none of the following methods work:

jl = Julia()
jl = Julia(jl_init_path="/Applications/Julia-0.4.5.app/Contents/Resources/julia/bin")
jl = Julia(jl_init_path="/Applications/Julia-0.4.5.app/Contents/Resources/")

In the latter case, I'm getting the following error:

FileNotFoundError: [Errno 2] No such file or directory: '/Applications/Julia-0.4.5.app/Contents/Resources/usr/bin/julia'

So obviously it's trying to find a path to Julia that starts with usr/bin/julia. However, there is no usr/ folder in /Applications/Julia-0.4.5.app. What's the best way to fix this?

like image 545
nathanielng Avatar asked Sep 17 '25 16:09

nathanielng


1 Answers

I set up a symbolic link from my /usr/local/bin directory (note: you'll probably need to use sudo to do this):

ln -s /Applications/Julia-0.4.5.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia

I use /usr/local/bin, you may need to change that to /usr/bin, if your version of Mac OS X allows that.

like image 72
Scott Jones Avatar answered Sep 20 '25 05:09

Scott Jones