Skip to content

Install Clojure CLIλ︎

Clojure CLI Logo

Clojure CLI is a command line tool for running a Clojure REPL, project or tool.

Clojure CLI automatically downloads required library dependencies, including the Clojure Standard library.

Clojure distributed as a library

Clojure is distributed as a library (.jar Java ARchive) via Maven Central.

A deps.edn file specifies the version of Clojure to be used with a project.

:deps {org.clojure/clojure {:mvn/version "1.12.0"}}

The Clojure CLI tool provides a default Clojure library version if not specified in the project or user deps.edn files.

Clojure releases

Practicalli Clojure CLI Config extends the Clojure CLI with a range of development tools as well as configuration for Clojure LSP and cljstyle code format tool.

Use the Linux script installer from - Getting Started to install or update to the latest stable release

curl -L -O && \
chmod +x && \
sudo ./

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

Use alternative location - unattended install

--prefix option specifies an alternative lolcation for the Clojure CLI install.

When permissions are not available or for automating the install without password prompt, use a local user specific install, e.g.

curl -L -O && \
chmod +x && \
./ --prefix $HOME/.local/

Include version number for specific release

Each Clojure CLI version is a number that represents the version of Clojure used and the build version of the Clojure CLI tool, e.g.

Clojure CLI Releases page

Include the version in the script name for repeatable environments, e.g. in Dockerfile configuration and Continuous Integraion workflows.

Clojure CLI install specific version
curl -L -O && \
chmod +x
sudo ./

Practically recommends setting XDG_CONFIG_HOME to the .config directory, to avoid creating another dot directory in the root of the user account. Add the following to ~/.bashrc for the bash shell or ~/.zshenv for Zsh.

export XDG_CONFIG_HOME="$HOME/.config"

Use the Homebrew command with the clojure/tools tap, as defined in the Getting started guide

brew install clojure/tools/clojure

Use Homebrew to update an install of Clojure CLI to the latest release

brew upgrade clojure/tools/clojure

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 comfortable using a Unix system on the command line.

Alternatively install, a command line installer for windows. Powershell 5 or greater is required. Follow the scoop-clojure getting started guide, summarized here:

Open "Windows PowerShell" and enter the following commands to configure the shell:

iwr -useb | iex
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Then in the same PowerShell window, install the Clojure related tools using the following commands:

scoop bucket add extras
scoop bucket add java
scoop bucket add scoop-clojure
scoop install git 7zip pshazz temurin-lts-jdk clj-deps leiningen clj-kondo vscode coreutils windows-terminal

Reference: Clojure CLI Install - Getting Started - official guide

Practicalli Clojure CLI Configλ︎

Add a wide range of community tools to extend the capabilities of Clojure CLI via the aliases.

Clone Practicalli Clojure CLI Config GitHub repository, first removing the $XDG_CONFIG_HOME/clojure and $HOME/.clojure directory if they exist.

User configuration locations

If XDG_CONFIG_HOME environment variable is set, then the user configuration is $XDG_CONFIG_HOME/clojure/deps.edn

Otherwise the user configuration is $HOME/.clojure/deps.edn.

CLJ_CONFIG environment variable can be used to set a custom location, overriding any other location.

Practicalli recommends FreeDesktop XDG location

Practically recommends setting XDG_CONFIG_HOME to the .config directory to simplify versioning of configuration.

Configure ~/.bashrc for the bash shell

Bash .bashrc file
export XDG_CONFIG_HOME="$HOME/.config"

Configure ~/.zshenv for Zsh

# Set XDG_CONFIG_HOME for clean management of configuration files
export XDG_DATA_HOME="${XDG_DATA_HOME:=$HOME/.local/share}"

If XDG_CONFIG_HOME environment variable is set, clone the repository to $XDG_CONFIG_HOME/clojure


git clone $XDG_CONFIG_HOME/clojure


git clone $XDG_CONFIG_HOME/clojure

Clojure CLI will look for its configuration in $HOME/.clojure directory if $XDG_CONFIG_HOME and CLJ_CONFIG environment variables not set. Via SSH ```shell git clone $HOME/.clojure


git clone $HOME/.clojure

Check Configurationλ︎

clojure -Sdescribe shows the version of Clojure CLI installed and configuration locations used.

clojure -Sdescribe

The output of the command includes the version of Clojure CLI in the :version key

{:version ""
 :config-files ["/usr/local/lib/clojure/deps.edn" "/home/practicalli/.config/clojure/deps.edn" ]
 :config-user "/home/practicalli/.config/clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/lib/clojure"
 :config-dir "/home/practicalli/.config/clojure"
 :cache-dir "/home/practicalli/.cache/clojure"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}

clojure -Sversion will shows the version of Clojure CLI being when the clojure command is used to run a REPL or other Clojure command.

Optional rlwrap readlineλ︎

The rlwrap binary is a basic readline tool that provides a history of commands entered into a terminal UI when running a Clojure REPL with the clj wrapper script.

Pressing the Up and Down keys will scroll through the code previously entered in the REPL.

rlwrap is available with most Linux systems. Look for install instructions by searching for rlwrap in a web browser or build from source from the 🌐 rlwrap GitHub repository.

Use Rebel Readline for a rich terminal UI experience

rebel readline is an advanced readline tool providing auto-completion, documentation, signature help and multi-line editing, all within a terminal UI

Rebel is a much richer experience than the clj wrapper with rlwrap. Rebel should not be used with clj.

Rebel Readline is part of the Practicalli Clojure CLI config.