100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Programming

Installing Clojure and Leiningen

A step-by-step guide to setting up a working Clojure development environment, including the JDK, the Clojure CLI tools, and Leiningen.

FoundationsBeginner9 min readJul 10, 2026
Analogies

Installing Clojure and Leiningen

Before writing any Clojure code, you need a working toolchain: a Java Development Kit (JDK) since Clojure runs on the JVM, the official Clojure CLI tools for running programs and managing dependencies via deps.edn, and often Leiningen, the long-standing build tool that scaffolds projects and manages builds through a project.clj file. Setting these up correctly the first time avoids most beginner frustration.

🏏

Cricket analogy: Setting up a Clojure development environment is like a fast bowler assembling match-day kit before a Test — you need the right boots (the JDK) as your base foundation, spikes correctly fitted (the Clojure CLI), and a properly weighted match ball (Leiningen for project management) before you can even walk out to bowl the first over.

Installing the Java Development Kit (JDK)

Clojure requires a JDK, typically version 11 or newer, since Clojure source compiles to JVM bytecode. Before installing any Clojure-specific tooling, check whether a compatible JDK is already present by running java -version in a terminal; if it's missing or too old, install one via a package manager like Homebrew on macOS, apt on Ubuntu, or an installer such as Eclipse Temurin.

🏏

Cricket analogy: Clojure needs a JDK the way a batter needs a properly certified bat — checking java -version before installing Clojure is like an umpire checking a bat's dimensions with a bat gauge before the toss, since an incompatible or missing JDK will get your setup rejected before play even starts.

Installing Clojure CLI Tools

The official Clojure CLI tools, invoked as clj or clojure, provide the simplest way to run Clojure code, start a REPL, and resolve dependencies declared in a deps.edn file. On macOS you can install them with Homebrew (brew install clojure/tools/clojure); on Linux, a shell installer script is provided on clojure.org; typing clj at the terminal drops you straight into an interactive REPL.

🏏

Cricket analogy: The Clojure CLI tools, invoked with clj or clojure, are like a captain calling for a specific field placement before a delivery — typing clj at the terminal immediately puts you into a live REPL, and deps.edn acts as the pre-agreed fielding chart declaring where every fielder (dependency) stands for the whole innings.

Installing and Using Leiningen

Leiningen is Clojure's original, still widely used build tool. It scaffolds new projects with lein new app my-app, generating a conventional folder structure (src, test) and a project.clj file that declares dependencies and build configuration, and it runs a project's main function with lein run. Installing it is typically a single package-manager command or downloading the lein shell script directly.

🏏

Cricket analogy: Running lein new app my-app to scaffold a project is like the ICC handing a newly promoted Associate nation a standardized ground layout — pitch dimensions, boundary rope distance, and sightscreen placement are all set up automatically to a known standard, the way Leiningen generates a conventional folder structure instantly.

bash
# Check Java is installed (JDK 11+ recommended)
java -version

# Install Clojure CLI tools (macOS via Homebrew)
brew install clojure/tools/clojure

# Verify the Clojure CLI
clj -e "(+ 1 2 3)"
;; => 6

# Install Leiningen (macOS via Homebrew)
brew install leiningen

# Scaffold a new Leiningen project
lein new app my-first-app
cd my-first-app

# Run it
lein run

The Clojure CLI tools (clj/clojure) and deps.edn are the officially maintained, minimal way to run Clojure and manage dependencies, while Leiningen predates them and adds project scaffolding, plugins, and build tasks via project.clj. Many teams use both: Leiningen for full project builds and clj for quick REPL experiments.

  • Clojure requires a Java Development Kit (JDK), typically version 11 or newer, since it runs on the JVM.
  • Verify your JDK installation with java -version before installing any Clojure tooling.
  • The official Clojure CLI tools (clj/clojure) use a deps.edn file to declare and resolve dependencies.
  • Leiningen is a popular build tool that uses a project.clj file and offers project scaffolding via lein new.
  • lein new app <name> generates a conventional project structure with src, test, and configuration files.
  • lein run builds and executes a Leiningen project's main entry point.
  • Many Clojure developers use both the CLI tools and Leiningen depending on the task at hand.

Practice what you learned

Was this page helpful?

Topics covered

#Programming#ClojureStudyNotes#InstallingClojureAndLeiningen#Installing#Clojure#Leiningen#Java#StudyNotes#SkillVeris#ExamPrep