Ian
Ian

Reputation: 1457

How to get the path to the julia binary that is used within a session?

From within a julia session, how can I get the path of the julia binary that is being used by that session?

Upvotes: 4

Views: 357

Answers (2)

The complete command that was used to run julia is given by Base.julia_cmd. If you want to spawn a new process, you should perhaps keep this whole command (including the system image):

julia> Base.julia_cmd()
`/home/francois/.local/julia-1.4.1/bin/julia -Cnative -J/home/francois/.local/julia-1.4.1/lib/julia/sys.so -g1`


If you only want the path to the julia binary, it is the first component of the command:

julia> Base.julia_cmd()[1]
"/home/francois/.local/julia-1.4.1/bin/julia"

Upvotes: 1

Ian
Ian

Reputation: 1457

joinpath(Sys.BINDIR, Base.julia_exename())

Upvotes: 4

Related Questions