Install Clojure

Establish a Clojure environment by installing the following:

Tools Required Purpose
Clojure CLI tools Essential Run Clojure REPL for development and production
Aliases for CLI tools Recommended Additional tools to enhance Clojure development experience
clj-kondo Recommended Static analysis of code to find all those little bugs
rlwrap Optional A simple read line for command history, used by clj

Hint::clj-kondo provides a permanent paring buddy

Configuring clj-kondo with your preferred editor will greatly enhance the joy of coding in Clojure by keeping your code idiomatic and free from a wide range of syntax bugs.

Clojure CLI tools

A command line REPL provides the essential tool for Clojure development. Installing a Clojure aware editor is recommended when developing Clojure projects.

{% tabs linux=”Linux”, homebrew=”Homebrew”, windows=”Windows” %}

{% content “linux” %}

Use the Linux script installer from Clojure.org

  1. sudo apt install curl rlwrap
  2. curl -O https://download.clojure.org/install/linux-install-1.10.1.536.sh
  3. chmod +x linux-install-1.10.1.536.sh
  4. sudo ./linux-install-1.10.1.536.sh

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

{% content “homebrew” %}

Use Homebrew on Linux or Windows with WSL

Install the command line tools with brew from the clojure/tools tap:

  1. brew install clojure/tools/clojure

{% content “windows” %} For Windows 10 use Windows Subsystem for Linux and Windows Terminal are recommended if you have administrative privileges and are happy to use a Unix system on the command line.

For earlier versions of Windows use scoop.sh is a command line installer for windows and is the recommended approach. Powershell 5 or greater is required.

Follow the scoop-clojure install instructions, summarized here:

  1. scoop install git
  2. scoop bucket add java
  3. scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
  4. scoop install adoptopenjdk-lts-hotspot
  5. scoop install clojure
  6. scoop update clojure

To also use scoop to install clj-kondo

  1. scoop bucket add extras
  2. scoop install clj-kondo

{% endtabs %}

Install Clojure CLI tools - common aliases

Create a fork of the practicalli/clojure-deps-edn on GitHub

Clone that fork to ~/.clojure/ and instantly have access to dozens of tools for Clojure software development

  1. git clone git@github.com:your-fork/clojure-deps-edn.git

All tools are provided via libraries and are only installed on first used.

If you choose not to use the practicalli/clojure-deps-edn repository or wish to use your own ~/.clojure/deps.edn then you should add an alias for the clj-new tool for creating projects as this is extensively used in this guide.

Install clj-kondo static analyser

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 when used with supported editors.

Follow the clj-kondo install guide for your operating system.

Optional: rlwrap readline

Install the rlwrap binary to support the clj wrapper, which launches a basic repl with command history. This approach is not as useful as using rebel readline.

rlwrap is available with most Linux systems and install instructions should be discoverable by searching for rlwrap in a web browser.