What is the best way to set the path to julia on Windows 10?

question
#1

I just installed Julia 1.0.1. I noticed that the executable wasn’t added to path, so I was wondering what is the best way to add julia to path?

I’m using Windows 10.

I thought about simply adding C:\Users\NAME\AppData\Local\Julia-1.0.1\bin\julia.exe because that is what the desktop shortcut is pointing to, but the location has the julia version in it. This means that any time julia is updated, the path will need to be modified again.

  1. Is there any better way to add julia to path?
  2. I did some searching and couldn’t find a lot of information about adding julia to path. Is there some reason it’s not good to have it on path?
#2

The windows home directory is not a fun place. To answer question 1: I think you need to adjust the path manually with each update.

Not specifically related to your question, but to make windows a bit less unfriendly I put

cd("C:/julia-home")
push!(LOAD_PATH, "C:/julia-home")

into my startup.jl, and work from there. Others may have better solutions.

#3

Here’s a pretty good reason:

Personally I don’t use other software that have these dependencies, so I add Julia’s bin folder to my Windows path anyway (for convenience when working with the Windows command line). I haven’t noticed any side effects in the past year, but YMMV.

1 Like
#4

Thanks for the responses. There are actually two reasons I want to add julia to path:

  1. If you use the julia shortcut that’s created on the desktop during install, I think it uses powershell. Whatever font is used in powershell doesn’t support all the unicode characters, for example \xor shows up as a box with a question mark in it. There is a different terminal I like to use called Hyper, which supports all the characters and has other features I like. If I want to use Hyper, then I need julia on path so I don’t have to type the full exe path every time.
  2. Even if I use the default powershell version of julia, it is a pain to browse to the desired working directory. @Adriel’s solution will help with that, but I don’t want to be forced to keep anything juila related in a single location. If julia is on path, then I can right click in any folder I want, open up the terminal at that directory, and then just run julia. Otherwise I need to launch julia and browse wherever I want using the terminal, which is much less convenient, especially in a deeply nested folder.
#5

An easy way to avoid the need to amend the path with each update is to install Julia in a folder like
c:\Julia-1.X\
Then, when a new version comes out, simply install it in the same folder (preferably after an uninstall of the old version).

#6

This is exactly what I do.

However, I only add the path to my powershell profile.

Add the following to Microsoft.Powershell_profile

function julia {C:\tools\Julia\julia-1.x\bin\julia.exe $args}
#7

The default installation path is pretty bad, it should try to install to program files, like all other software, or C:\julia

#8

I agree. I can never find anything anymore when it is spread throughout configuration directories, APPDATA, registry, etc.

I might be wrong, but I think the reason things are being installed into local user directories instead of program files is because it gets around system permissions. Some workplaces restrict installations that modify system directories, and rather than having to whitelist a program or get permission, installing it in appdata installs without issues.

#9

True, but that can be an option during installation and same with an unchecked option to add to path (with a warning, similar to git and anaconda installers).

#10

100% Agree. There was a discussion ~4 years ago about this but I don’t remember anymore why devs insisted in installing Julia on that dir. I never let it do so and because I also hate dirs with spaces in their names, for me Julia always go to C:\programs\julia-x.x. Than I call it via a batch file that also sets the path.

1 Like
#11

I know this thread is old, but as a PSA/posterity for people continuing to struggle with this:

Create a new “safe” directory and add it to Windows path (or use an existing one) and put a batch file in your new directory containing:
"C:\path\to\julia.exe" %* and name it “julia.bat” This will sidestep the .dll issue and let you launch julia by just typing it from cmd.exe or powershell. Arguments work too.