Install Clojure

Establish a Clojure environment by installing the following:

  • Clojure CLI tools to run the REPL and projects (Leiningen and Boot should also work)
  • practicalli/clojure-deps.edn to create projects and use other Clojure community CLI tools
  • clj-kondo to lint your code and show syntax errors / idioms as you type
  • (optional) rlwrap, a read line tool for an interactive command line
  • (optional) Babashka to run a shell for Clojure scripting

Clojure CLI tools

Clojure CLI tools provides the simplest way to run the Clojure REPL and Clojure projects.

Install the rlwrap package to add readline support for the clj command line.

Use the Linux script installer from

sudo apt install curl rlwrap

curl -O
chmod +x
sudo ./

The installation creates /usr/local/bin/clj, /usr/local/bin/clojure, and /usr/local/lib/clojure

With Mac OSX Homebrew or Homebrew on Linux or Windows with WSL installed.

Open a terminal window and run the following command line to install Clojure from the official clojure/tools tap:

brew install clojure/tools/clojure

An early release version of clj on Windows is available.

Clojure CLI - additional tools

Fork and clone the practicalli/clojure-deps-ed) to ~/.clojure

;; fork on GitHub to version your own configuration
git clone ~/.clojure

Alternatively, edit ~/.clojure/deps.edn and add the alias called :new to create new Clojure projects from templates.

  {:extra-deps {seancorfield/clj-new {:mvn/version "1.0.199"}}
   :main-opts  ["-m" "clj-new.create"]}

Install clj-kondo static analysis tool

clj-kondo performs static analysis on Clojure, ClojureScript and EDN, without the need of a running REPL. It informs you about potential errors while you are typing.

Install the clj-kondo binary. clj-kondo --version should run in a terminal shell.

Spacemacs integration requires the syntax-checking layer and the clojure-enable-linters variable added to the clojure layer, within the dotspacemacs-configuration-layers of the .spacemacs file.

SPC f e d opens the .spacemacs file

SPC s s dotspacemacs-configuration-layers RET to jump to that section of the file

Add clojure-enable-linters variable to the clojure layer

(clojure :variables
             clojure-enable-linters 'clj-kondo)

Add the syntax-checking layer

SPC f s to save and SPC q r to restart Emacs and download any additional packages.

clj-kondo has sensible default configuration, however its simple to add your own configuration

Babashka Clojure Scripting (optional)

Babashka is a command line shell that runs Clojure scripts, an alternative to Bash scripting. As Babashka runs Clojure it can also be used from Spacemacs by starting an nrepl service and using cider-connect-clj

bb -nrepl

Babashka install guide

results matching ""

    No results matching ""