Clojure

Getting Started

Welcome to Clojure!

Check out Learn Clojure, Resources, or Books to learn the language! If you have questions, you can search or ask at the official forum Ask Clojure.

Dependencies

Clojure requires Java. Clojure officially supports Java LTS releases (currently Java 8 and Java 11), but also tries to ensure interim versions work as well. You can use any Java installation, whether it’s a commercial release from Oracle or an open source version based on OpenJDK (like adoptopenjdk).

The Clojure tools require that either the java command is on the path or that the JAVA_HOME environment variable is set.

Clojure installer and CLI tools

Clojure provides command line tools that can be used to start a Clojure repl, use Clojure and Java libraries, and start Clojure programs. See the changelog for version information.

After following these installation instructions, you should be able to use the clj or clojure command to start a Clojure repl.

Installation on Mac via Homebrew

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

brew install clojure/tools/clojure

If you’ve already installed, you can upgrade to the latest release with:

brew upgrade clojure/tools/clojure

Clojure brew formulas use "devel" blocks, which have been deprecated by brew. We will be updating these brew formulas to address the issue, but for now, it is only a warning and you can proceed! Everything will work despite the warning.

Also see: Clojure’s Homebrew tap for more information.

Installation on Linux

Note: You can now use Homebrew on Linux or Windows with WSL, similar to the Mac installation.

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 /usr/local/bin/clj, /usr/local/bin/clojure, and /usr/local/lib/clojure:

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

Installation on Windows

An early release version of clj on Windows is available at clj on Windows. Please provide feedback at https://clojure.atlassian.net/projects/TDEPS.

Other ways to run Clojure

Local build

Download and build Clojure from source (requires Git, Java, and Maven):

git clone https://github.com/clojure/clojure.git
cd clojure
mvn -Plocal -Dmaven.test.skip=true package

Then start the REPL with the local jar:

java -jar clojure.jar

Try Clojure online

repl.it provides a browser-based Clojure repl for interactive exploration.

Build tools

Build tools provide a range of capabilities for building, running, and deploying Clojure libraries and applications. The two most popular Clojure build tools are Leiningen and Boot.

Original author: Alex Miller