clojure Installation and Setup


Example

Option 1: Leiningen

Requires JDK 6 or newer.

The easiest way to get started with Clojure is to download and install Leiningen, the de facto standard tool to manage Clojure projects, then run lein repl to open a REPL.

Linux

curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/bin/lein
export PATH=$PATH:~/bin
chmod 755 ~/bin/lein

OS X

Follow Linux steps above or install with macOS package managers.

Install with Homebrew

brew install leiningen

Install with MacPorts

First install Clojure

sudo port -R install clojure

Install Leiningen, a build tool for Clojure

sudo port -R install leiningen
lein self-install

Windows

See the official documentation.

Option 2: Official Distribution

Requires JRE 6 or newer.

Clojure releases are published as simple JAR files to be run on the JVM. This is what typically happens inside the Clojure build tools.

  1. Go to http://clojure.org and download the latest Clojure archive

  2. Extract the downloaded ZIP file into a directory of your choice

  3. Run java -cp clojure-1.8.0.jar clojure.main in that directory

    You may have to substitute the clojure-1.8.0.jar in that command for the name of the JAR file that you actually downloaded.

    For a better command-line REPL experience (e.g. cycling through your previous commands), you might want to install rlwrap: rlwrap java -cp clojure-1.8.0.jar clojure.main

Option 3: Boot

Requires JDK 7 or newer.

Boot is a multi-purpose Clojure build tool. Understanding it requires some knowledge of Clojure, so it may not be the best option for beginners. See the website (click Get Started there) for installation instructions.

Once it's installed and in your PATH, you can run boot repl anywhere to start a Clojure REPL.