User Tools

Site Tools

julia> pkgchk.( [ "julia" => v"1.0.3" ] );

Installation and Getting Started

WARNING Versions prior to Julia 1.0 are obsolete. Do not install them.

Download Julia for your computer from julialang. Make sure to download a version that matches your operating system (Windows/macOS/Linux).

Operating-Specific Julia Installation


Julia Computing offers an "install-free" browser version, with optional customer support. JuliaBox is nicely integrated for academic teaching purposes, too, and very reasonably affordable.


FIXME Do not trust my Windows description. I am not a Windows user. I need to run this by someone who knows this.

Run the Julia installer from julialang. Julia usually installs into C:\Users\YourUserName\AppData\Local\Julia-1.0.*.

If you want to run julia from the command line (rather than through the Windows App), then set the variable JULIA_HOME to Julia's \bin directory, usually C:\Users\YourUserName\AppData\Local\Julia-1.0.*\bin. Setting environment variables is often easiest to do by typing env into the search start, and choosing Edit the system environment variables.

If you want to run julia scripts from other directories, add %JULIA_HOME% to your %PATH%.

[download only julia statements]
c:/> set JULIA_HOME C:\Users\YourUserName\AppData\Local\Julia-1.0.*\bin

If you use setx instead of set, then this becomes stored in the registry.

On Windows, users often start julia with a click on the julia app.


  • On macos, install 'Apple XCode developer' from the appstore first (xcode-select install from the command line). It will save you many headaches later on.
  • Doubleclick (open) the julia*.dmg file, and drag the Julia application to (the usual program folder) /Applications/.
  • Make the binary accessible from the the command line:
[download only julia statements]
bash> ln -s /Applications/Julia-*.app/Contents/Resources/julia/bin/julia /usr/local/bin/
bash> julia

On macos, users often start julia from the terminal (command line). Julia is smart about figuring out where its packages are, provided the OS can find the executable (usually determined by the OS PATH). That is, the only necessary user intervention is to tell the OS where to locate the binary. (This is how all programs should be!) For startup options, try $ julia --help.


WARNING Do not obtain julia itself from the standard OEM [ubuntu/debian/redhat] repositories. They are often badly out of date.

  • On linux, start with by installing make and gcc. The compiler may not be necessary for many julia users, but the cost is small, and it reduces confusion later on.
    • On ubuntu, use apt install make gcc.
    • On Fedora, use yum install make gcc.
  • Run tar xfz julia*.tar.gz. The archive expands into a 'julia-*' directory.
  • Move this julia-* directory to a good directory of your choice. My choice was /usr/local/src/.

In sum, your installation should look something like the following (perhaps with a different version number):

[download only julia statements]
bash> JV=1.0.2
bash> cd ~/Downloads
bash> wget$JV-linux-x86_64.tar.gz
Resolving (
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 88405778 (84M) [application/octet-stream]
Saving to: 'julia-1.0.2-linux-x86_64.tar.gz'
julia-1.0.2-linux-x86_64.tar.gz  100%[==========================================================>]  84.31M  29.7MB/s    in 2.8s
2018-10-08 18:15:22 (29.7 MB/s) - 'julia-1.0.2-linux-x86_64.tar.gz' saved [88405778/88405778]
bash> tar xfz julia-$JV-*.tar.gz
bash> ls julia-$JV
bash> sudo mv ~/Downloads/julia-* /usr/local/src/
bash> sudo ln -s /usr/local/src/julia-*/bin/julia /usr/local/bin
bash> cd ~
bash> julia

On linux, users often start julia from the terminal (command line). Julia is smart about figuring out where its packages are, provided the OS can find the executable (usually determined by the OS PATH). That is, the only necessary user intervention is to tell the OS where to locate the binary. (This is how all programs should be!) For startup options, try $ julia --help.

Jupyter Browser Frontend

Jupyter is a beautiful notebook browser-based front-end for Julia, Python, and R. Quantecon has an excellent installation and getting started guide. Roughly, you need to do the following:

  1. Install Anaconda Python. Anaconda comes with Jupyter and other scientific tools.
  2. In your operating system command line (shell), type julia. in julia, when you see julia> , type Pkg.add("IJulia"); exit(0).
  3. Open the newly installed Anaconda application. (For example, in macos, open the application 'Anaconda-Navigator'.)
  4. There is a command line executable that allows you to invoke jupyter directly. For example, on macos, it is ~/anaconda3/bin/jupyter_mac.command. You can navigate to your work directory and invoke it directly.

Many users like to use Juno, which is another modern IDE that can handle Julia with aplomb.

Starting Over from Scratch and Reinstallating Julia

Julia libraries and other user files are typically stored in

OS Binary Distribution User+Customization
Windows %LOCALAPPDATA%\Julia-1.x,y %USERPROFILE%\.julia
macOS /Applications/Julia-1.x/ ~/.julia/
Linux No default ~/.julia/

For JuliaPro (which often lags the standard Julia release):

OS Binary Distribution User+Customization
Windows %LOCALAPPDATA%\JuliaPro-1.x.y.z %LOCALAPPDATA%\JuliaPro-1.x.y.z\pkgs-1.x.y.z
macOS /Applications/JuliaPro-1.x,y, /Applications/
Linux No default JuliaPro-1.x.y.z/JuliaPro/pkgs-1.x.y.z/

Deleting these directories should completely start over.

Information about the Current Julia Installation (Version, Matrix Libs, etc.)

Start julia. When you see the REPL prompt, you can type commands.

[download only julia statements]
julia> VERSION
julia> versioninfo()
Julia Version 1.0.2
Commit 0d713926f8 (2018-09-29 19:05 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
julia> using LinearAlgebra; LinearAlgebra.versioninfo()
LAPACK: libopenblas64_
julia> exit(0)

Using Different Julia Versions on the Same Computer

Julia versions keep all information in directories under ~/.julia/. JuliaPro uses an altogether different directory, too.

Batch Invocation

To run your Julia program in batch, use the unix terminal (or Windows cmd):
[download only julia statements]
$ julia mypgm.jl > mypgm-output.log

This saves the output to the file mypgm-output.log.

Interactive Use (REPL = Read-Eval-Print)

The REPL is a convenient way to interact with Julia. (It was already used above.) Just invoke julia without an argument.

To exit, you can run the exit() function (or C-D).

  • Emacs ESS understands .jl syntax.
  • JuliaPro also comes with an IDE named Juno based on the Atom editor.
  • Jupyter is itself a complete environment.

'Hello World!' in (Techni)color

julia> printstyled("Hello World!"; bold= true, color=2)		## keyword arguments after ';'
Hello World!

Auto Completion

Hit <TAB> to see possible completions.

UTF-8 Conversion

Type '\sqrt' and hit <TAB> to see conversion into the UTF character. (This works for some other TeX math symbols, too.)

Unix Shell Escape

When ; ls typed into the REPL, it runs the Unix shell command (ie., no need to exit to the shell).

Help Shell

When ? is typed, the prompt changes to help. Type what you are interested in.

Command Line Editing

The REPL command-line editing commands are emacs-like. The most important are

  • C-P (previous line), (C- means the control key is held down simultaneously)
  • C-N (next line),
  • C-A (start of line),
  • C-E (end of line),
  • C-B (back character),
  • C-F (forward character).
  • cursor keys,

The end-of-line key (Enter), C-P, and C-N work differently depending on whether the cursor is at the end of the line or not.

Running a Julia source file.jl program in the REPL

[download only julia statements]
julia> include("another.jl")	## executes another.jl
  • if another.jl includes other.jl, julia includes other.jl from the directory in which another.jl lives. So, an include("../another.jl") will look for other.jl in .. and not in . .

Suppressing Output

Julia does not print output for commands ending with a semi-colon. The following should not create any output:

julia> rand(10000);		## usually a lot of output
  • There is a buglet in the 1.0.2 REPL parser. julia> rand(10000); # buglet;buglet should be quiet, but the semicolon followed by text makes the REPL print the random values, after all.

Reducing Long Vector Output on the REPL

Sometimes, it is useful to tell the REPL to produce a lot or a little output. Sometimes, this is best done by pretending to have a very long or very wide display (e.g., when you want to copy and paste REPL output elsewhere)—or the opposite.

julia> IOContext( stdout, :compact => true );

julia> IOContext( stdout, :displaysize => (25,80) );

Startup: Loading A Standard Configuration File

The standard julia startup file is .julia/config/startup.jl (formerly ~/juliarc.jl). Moreover, for project-specific startup files, you can include in this startup file the following:
[download only julia statements]
$ cat ~/.julia/config/startup.jl
isinteractive() && isfile("_init.jl") && require("_init.jl")
  • If an atreplinit() function has been defined, it is called (only) before the REPL starts. This can be useful to customize the interface.
  • Be careful: when you define functions in your startup, your Julia becomes different from the Julia that another user is running. Ergo, this can occasionally lead to baffling errors when sharing code. You can start julia with --startup-file=no to check if the Julia startup file is at fault.

Terminal and Emacs Aspects

Terminal Support

Under macos, I recommend iTerm2 for a better terminal. Under linux, the standard gnome terminal is good enough.

If your terminal also has UTF-8 support, the output will be more pleasant.

Julia uses the stty cols aspect of the terminals. This is often set by the terminal program when the window size is changed, but it can also be manually set, e.g., by stty cols 132.

Emacs Support

Emacs is primarily supported through ESS. You may want to add

[download only julia statements]
(add-to-list 'auto-mode-alist '("\\.jl\\'" . julia-mode) )

to your ~/.emacs.d/init.el. (It helps enable C-X Backquote (next-error).)

In terminal-mode use, UTF-8 characters are displayed if the ~/.emacs.d/init.el also contains

[download only julia statements]
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(define-coding-system-alias 'UTF-8 'utf-8)

There is also a julia-repl package, which is en Emacs mode that provides a Julia REPL inside Emacs using ansi-term.


Useful Packages on Julia Repository

  • [OhMyREPL] adds color, syntax, and bracket highlighting to the REPL
  • [Julia-REPL] is an inside-emacs REPL mode.


  • There are other REPL submodes (such as ']' which gets you into a special package manager mode).
  • Similar to R's sink(file=..., split=TRUE) is not yet possible.
  • Julia 1.0.2 does not yet have a “default output” option, e.g., allowing the user to set output to preferentially default to x digits of significance.

Not-Yet Implemented

Logging Input and Output of an Interactive Session

Similar to R's sink(file=..., split=TRUE) is not yet possible. The closest is the logging function.

FIXME Investigate redirect_stdout — I could not get this to work.


Unlike R, Julia does not yet have good global options to control printing behavior. For example, you cannot give control of the number of rows that long displays show in full. For example, you cannot specify that you like 3 significant digits in numeric output.

This is a planned feature for the future.


installation.txt · Last modified: 2018/12/27 13:27 (external edit)