Clojure

Install Clojure

Mac OS instructions

Prerequisites: brew, Java

This adds the commands clojure and clj to your system from the clojure/tools tap:

brew install clojure/tools/clojure

Linux instructions

Prerequisites: Java, bash, curl, rlwrap

To install with Linuxbrew (requires brew):

brew install clojure/tools/clojure

To install with the Linux script installer:

  1. Ensure that the following dependencies are installed: bash, curl, rlwrap, and Java.

  2. Use the linux-install script to download and run the install, which will create the executables /usr/local/bin/clj, /usr/local/bin/clojure, and the directory /usr/local/lib/clojure:

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

To install to a custom location (like /opt/infrastructure/clojure), use the option --prefix:

sudo ./linux-install-1.11.1.1165.sh --prefix /opt/infrastructure/clojure

You may also want to extend the MANPATH in /etc/man_db.conf to include the manual pages:

MANPATH_MAP /opt/infrastructure/clojure/bin /opt/infrastructure/clojure/man

The linux-install script can be removed after installation.

Windows instructions

Prerequisistes: Java

An early release version of clj on Windows is available at clj on Windows. Please provide feedback on Ask Clojure or Clojurians slack in #clj-on-windows.

Prerequisite installation details

brew (Mac or Linux)

brew is a package manager for Mac OS X or Linux. To install brew:

Java

Clojure requires Java. Clojure officially supports Java LTS releases (currently Java 8, 11, and 17), but also tries to ensure interim versions work as well. You can use any Java distribution, whether it’s a commercial release from Oracle or an open source version based on OpenJDK (like Temurin). The Clojure tools require only that the java command is on the PATH or that the JAVA_HOME environment variable is set.

If you don’t already hava Java installed, we recommend installing Adoptium Temurin 17.

To use the Adoptium Temurin installers:

  • Go to https://adoptium.net/

  • Download and run the installer appropriate to your platform

  • Ensure java is on the system PATH (see this option on the Custom Setup page)

On Mac, you can also install Temurin using brew:

  • brew tap homebrew/cask-versions - add the cask-versions tap to Homebrew

  • brew install --cask temurin17 - install Temurin 17 (formerly AdoptOpenJDK)

Check your Java version by running java --version. If that’s not Temurin 17, then you may then need to add java to your PATH:

echo 'export PATH="/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin:$PATH"' >> ~/.zshrc

More information

For other versions of the Clojure command-line tools, see the changelog for version history and the Clojure tap for info on installing older versions or newer prereleases instead.

Original author: Alex Miller