Installing and Running Julia#

Standard Installation#

Installing Julia is very easy:

  • Go to the Julia downloads page

  • Pick the installer for your platform, use the current stable release

  • Unpack/install locally

N.B. If you installed a tarball, you might need to add Julia’s bin directory to your PATH.

Running Julia#

  ~ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.3 (2023-08-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

You will be to now type Julia commands in a standard REPL environment: read, evaluate, print, loop.

This is an almost exact Julia analogue of Python’s ipython.

julia> println("hello, world!")
hello, world!

julia> (2+3)^2
25

julia> 

Notebooks#

Julia will run in a Jupyter notebook environment, e.g., using Jupyter Lab or in VS Code

Julia Scripts#

Finally, let’s just observe that Julia scripts work just as one would expect:

#! /usr/bin/env julia

function main()
    println("hello, world! let's calculate a sum of squares")

    total = 0
    for i in 1:10
        total += i^2
    end

    println("The answer is $(total)")
end

main()

So let’s execute that:

$ julia julia-script.jl
hello, world! let's calculate a sum of squares
The answer is 385

Bonus Installation Method: juliaup#

Another way to manage a Julia install is with Juliaup - a Julia toolkit installation manager inspired by the excellent Rustup for the Rust programming language.

Juliaup is available from the Windows App Store, if you’re developing with a Microsoft system, or via direct installation script for MacOS and Linux distributions (see the link)

Once installed, you can simply type in a terminal:

juliaup list

to show all the versions of Julia available.

We will work with the latest release version on all platforms (1.9 as of writing) so simply type

juliaup add release

to set that up.

The big bonus with juliaup is that you can easily have multiple Julia releases installed at once, and Juliaup will let you configure which is your default at any point in time.

Keep juliaup updated with

juliaup self update