Skip to content

Julia REPL Guide — Interactive Development and Package Management

DodaTech Updated 2026-06-28 2 min read

In this tutorial, you will learn about Julia REPL Guide. We cover key concepts, practical examples, and best practices to help you master this topic.

Julia's REPL (Read-Eval-Print Loop) is the primary interface for interactive development -- combining code execution, package management, documentation access, and shell commands in one terminal environment.

Starting the REPL

julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.0 (2024-01-20)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

REPL Modes

# Normal mode (julia>)
x = 42
println("Hello")

# Package mode (] add, ] rm, ] up)
# Press ] to enter
# Press Backspace to leave

pkg> add DataFrames Plots
pkg> status
pkg> update

# Help mode (?) - press ?
# Press Backspace to leave

help> println
help> sort

# Shell mode (;) - press ;
# Press Backspace to leave

shell> ls
shell> pwd

Basic REPL Usage

julia> 2 + 2
4

julia> println("Hello Julia!")
Hello Julia!

julia> x = [1, 2, 3]
3-element Vector{Int64}:
 1
 2
 3

julia> sum(x)
6

julia> ans  # last result
6

Package Management

# Using Pkg (package manager)
import Pkg

# Add packages
Pkg.add("DataFrames")
Pkg.add("Plots")

# Create and activate project
Pkg.generate("MyProject")
Pkg.activate("MyProject")

# List packages
Pkg.status()

# Update all
Pkg.update()

Common Mistakes

1. Forgetting Pkg. prefix

In REPL normal mode, use Pkg.add("Package"). In package mode (]), just add Package.

2. Not activating project environment

Without Pkg.activate("./project"), packages install globally.

3. Using ans incorrectly

ans holds the last evaluated expression result but is overwritten by every new expression.

Practice Questions

1. How do you enter package mode? Press ] at the Julia REPL. Press Backspace to return to normal mode.

2. How do you access documentation? Press ? then type the function name. Or use println(help(sin)) programmatically.

3. How do you exit the REPL? Press Ctrl+D or type exit().

FAQ

{{< faq question="Can I save REPL session history?" >}} Yes. Julia saves history to ~/.julia/logs/repl_history.jl. The REPL also supports searching history with Ctrl+R. {{< /faq >}}

{{< faq question="How do I clear the REPL screen?" >}} Press Ctrl+L to clear the screen. Or type print("\033[2J"). {{< /faq >}}

{{< faq question="Can I run Julia code from a file in the REPL?" >}} Yes. include("file.jl") loads and executes the file in the current REPL session, giving access to all defined functions. {{< /faq >}}

What's Next

Now learn about Julia's type system.

Topic Description Link
Types Type hierarchy and parametric types {{< ref "03-types" >}}
Multiple Dispatch Methods and dispatch {{< ref "04-multiple-dispatch" >}}

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro