Set up Clojure: a flowchart
Brand new to Clojure? Follow the arrows. Each situation has one recommended route, so you don't spend a day choosing tools before you've seen what Clojure is like. You'll finish with a REPL running this template, ready for the tutorial.
What you need:
- Java and the Clojure CLI.
- Babashka. This template's README calls it optional, but the tutorial uses its
bbcommands, andbb new-dayhas no plain-clojureequivalent. Install it too. - An editor.
If you'd rather install nothing, use Codespaces (step 2).
Each install command here comes from clojure.org's Install Clojure guide or the Babashka README. If a command fails, those pages are the authority. These commands were compared with those pages on 2026-11-24, not run on every system.
The same path as steps, with the commands:
1. New to programming?
Start with Clojure Camp: its handbook, and its mob sessions, which are scheduled on Meetup and announced in the Clojure Camp Discord. Then come back here.
2. Install, or not?
Don't want to install anything, or on a work laptop? Use Codespaces, if your employer or school allows it.
- Click Use this template on GitHub to make your own copy.
- On your copy, choose Code โ Codespaces โ Create codespace. It installs Java, the Clojure CLI, Babashka and Calva for you.
- Wait for the setup to finish. After the codespace opens, its setup command (
postCreateCommandindevcontainer.json) may still be running in a terminal. It installs the Clojure CLI, downloads the libraries, then installs Babashka. Until it ends,clojureorbbmay not be found. - Then go to step 6 and start the REPL.
Personal GitHub accounts include some free Codespaces use each month; see GitHub's Codespaces billing page.
Otherwise, go to the steps for your operating system.
3. Install Java, the Clojure CLI and Babashka
Prefer a video? The Clojure team's Zero to REPL videos on ClojureTV walk through this for your system (clojure.org's announcement shows the macOS one). They cover Java, the Clojure CLI and Calva, but not Babashka:
macOS
These steps use Homebrew, clojure.org's route on macOS. If brew --version doesn't work, install Homebrew from that page first.
# Java: only if `java --version` doesn't already show 21 or newer.
# clojure.org recommends Temurin 25 if you don't have Java.
brew install --cask temurin@25
# Clojure CLI. Trusting the tap is a one-time step.
brew trust clojure/tools
brew install clojure/tools/clojure
# Babashka
brew install borkdude/brew/babashka
- Java: the Temurin installer may ask for your password. If
java --versiondoesn't show Temurin 25 afterwards, the install guide's Java section explains how to put it on yourPATH. - Babashka: if Homebrew warns
Skipping babashka: tap formula is not trusted, runbrew trust borkdude/brew, then install again.
Linux
Java. Install Temurin 25 from Adoptium's Temurin downloads (Adoptium's Linux install guide has package-manager steps), or use your distribution's OpenJDK package, version 21 or newer. Clojure works with "any Java distribution", and this template's README asks for Java 21 or newer. Afterwards, check that
java --versionworks in a new terminal.Clojure CLI. It needs
bash,curlandrlwrap; install them with your package manager if they're missing. Then download the installer into a temporary folder and run it:cd "$(mktemp -d)" curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh chmod +x linux-install.sh sudo ./linux-install.shIt uses
sudobecause it installs into/usr/local:/usr/local/bin/clj,/usr/local/bin/clojure,/usr/local/lib/clojure, and man pages in/usr/local/share/man/man1. You can read the script first withless linux-install.sh.Babashka. In the same temporary folder:
curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install chmod +x install ./install- It installs into
/usr/local/bin. - If you get a permission error, run
sudo ./install, or./install --dir ~/.local/binto install somewhere you own. - If
bb --versionthen says "command not found", that folder isn't on yourPATH. - If you use Homebrew on Linux,
brew install borkdude/brew/babashkaworks too.
- It installs into
Windows
- With WSL (Windows Subsystem for Linux): this is clojure.org's recommendation. Install WSL, open your Linux shell, and follow the Linux steps there. In clojure.org's words, WSL "will provide the closest match for most existing Clojure tutorials and documentation". The tools live inside WSL, so the editor has to work inside WSL too; step 5 covers that.
- Without WSL: use Codespaces (step 2).
- Other options: install Java, then clj-msi for the Clojure CLI (a community installer that clojure.org links to).
- For Babashka, see the Windows section of the Babashka README. It uses scoop, which you install by running a script from get.scoop.sh.
4. Check all three
Run these in a new terminal:
java --version # should show 21 or newer
clojure --version # should show Clojure CLI version 1.12 or newer
bb --version # should print a version
- If
java --versionsays "Unrecognized option", your Java is older than 9: install a newer one. - If any check fails, ask in
#adventofcodeon Clojurians Slack and paste the error.
5. Pick an editor
- No editor yet, or you use VS Code: install VS Code, then the Calva extension. In VS Code's Extensions view, search for "Calva". Calva's Getting Started page has more.
- On Windows with WSL: install VS Code on Windows, then its WSL extension. When you get this template in step 6, clone it inside WSL. Then, from the WSL shell in the repo folder, run
code .. VS Code opens a window connected to WSL. Install Calva in that window, so it runs inside WSL (Calva's WSL page). - You already use another editor: find a Clojure plugin for it on clojure.org's editors page.
6. Start the REPL
If you're not in Codespaces, get this template: click Use this template on GitHub, or clone it. Then open the folder in your editor.
- In Calva: open the Command Palette and run Calva: Start a Project REPL and Connect (aka Jack-In). Choose
deps.edn. Calva then asks you to "Pick any aliases to launch with": leave them all unticked and press Enter. Some aliases, such as:test, start another program, like the test runner, instead of a REPL (Calva's Jack-in docs). Calva remembers what you pick for next time. - In a terminal: run
bb repl, then use your editor's "connect to a running REPL" command.
The first start downloads the template's libraries, so it can take a minute or more.
Type (+ 1 2) in any .clj file and evaluate it. In Calva, put the cursor after the ) and press Ctrl+Enter. You should see 3.
You're set up. Continue with the tutorial, from step 3.
Using an AI agent?
If you use an AI coding agent, it can do steps 3โ5 with you and explain each one as it goes. Point it at the setup-clojure skill (ai/skills/setup-clojure/SKILL.md). It's optional; everything above works without AI.
Where these commands come from
- Java and the Clojure CLI: clojure.org, Install Clojure.
- Babashka: the Babashka README.
- The videos: Zero to REPL, by the Clojure team, on ClojureTV: macOS (announced on clojure.org), Linux, Windows (WSL).
- Codespaces: GitHub's What are GitHub Codespaces?
- Editors: clojure.org, Editors.