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, only used by clj

Aliases provided by practicalli/clojure-deps-edn

practicalli/clojure-deps-edn provides a user wide configuration of over 30 aliases to support Clojure devlopment. These aliases use meaningful names to avoid clashes with project specific aliases, ensuring that the user wide aliases remain available in all projects.

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.

Use the Linux script installer from Clojure.org

sudo apt install curl rlwrap

curl -O https://download.clojure.org/install/linux-install-1.10.1.536.sh
chmod +x linux-install-1.10.1.536.sh
sudo ./linux-install-1.10.1.536.sh

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

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

brew install clojure/tools/clojure

Use Homebrew on Linux or Windows with WSL

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:

scoop install git
scoop bucket add java
scoop bucket add scoop-clojure https://github.com/littleli/scoop-clojure
scoop install adoptopenjdk-lts-hotspot
scoop install clojure
scoop update clojure

To also use scoop to install clj-kondo

scoop bucket add extras

scoop install clj-kondo

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 across all projects.

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

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

If you choose to use your own ~/.clojure/deps.edn then add an alias for the clj-new tool and rebel readline as this is extensively used in this guide.

clj-kondo static analyser / linter

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.

clj-kondo provides a 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.

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.

results matching ""

    No results matching ""