Install Clojure

Here's a quick, straightforward way to install Clojure on MacOS.

Install Java

First, you need the JDK. You can get that in a lot of ways. It's nice to have a utility to help you manager versions of the Java JDK. asdf is such a version manager -- and currently, the best.

Now with asdf, you can install the JDK. List what's available with:

asdf list all java

Then choose one to install, such as:

asdf install openjdk 1.17.0

Now mark your project to use it:

asdf local openjdk 1.17.0

Install Clojure on MacOS

If you're on Mac, you probably have brew installed. If not, get that. Then use brew to install Clojure:

brew install clojure/tools/clojure

Install Clojure on Linux

The linux install requires downloading the installer script. This differs by version. Go to the official install instructions for the latest url. As of this writing, it's:

curl -O
chmod +x
sudo ./

Try it out

Now you should be able to start up a Clojure REPL with:

$ clojure

Clojure 1.11.1
user=> (+ 1 1)

Installed. Now go and wrap your life in parens.

Bonus: clj command

If you try to run the clj command (instead of clojure), you might get this error:

Please install rlwrap for command editing or use "clojure" instead.

To install rlwrap, run:

sudo apt install rlwrap