Clojure
Share your thoughts in the 2024 State of Clojure Survey!

Programming at the REPL: Launching a Basic REPL

Use any of the following methods to start a basic Clojure REPL in a terminal window:

Using the CLI tools

The easiest way to start a Clojure REPL is with using the clj command of the Clojure CLI tools:

clj ## run this command in a terminal window

You should see output like the following:

Clojure 1.9.0
user=>

See Getting Started to learn how to install the Clojure CLI.

You can exit the REPL by typing Ctrl+D (pressing the Ctrl and D keys at the same time).

Using a project management tool

Leiningen

If you have installed Leiningen, you can use it to launch a REPL:

lein repl

You should see output like the following:

nREPL server started on port 64411 on host 127.0.0.1 - nrepl://127.0.0.1:64411
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_05-b13
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=>

If you run lein repl from inside a Leiningen project directory, the library dependencies and source code of the project will be available at the REPL.

Boot

If you have installed Boot, you can use it to launch a REPL:

boot repl

You should see output like the following:

nREPL server started on port 50109 on host 127.0.0.1 - nrepl://127.0.0.1:50109
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.9.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_05-b13
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=>