Clojure: Install

By Xah Lee. Date: . Last updated: .

You need to install Java first.

To install Java, see: Java Tutorial: Install Java

As of , current Java version is 1.8. (also known as Java 8, because of marketing reasons.)

Install Clojure

As of , current Clojure version is 1.8

Download here http://clojure.org/downloads

Unpack it, by tar xvfz filename.

For example, after unpacking, i have this file clojure-1.8.0.jar.

Start Clojure REPL

clojure 1.8 repl 2016-03-06
Clojure REPL

Start Clojure like this:

# start clojure repl
java -cp /home/xah/clojure-1.8.0.jar clojure.main

(make sure the Clojure jar file path above is where you have it)

To make it convenient, set a alias in your ~/.bashrc, like this:

alias clojure="java -cp /home/xah/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar clojure.main"

Now you can start Clojure REPL by just typing “clojure”.

[see Difference Between .bashrc, .profile, .bash_profile, …?]

(REPL = “Read Eval Print Loop”. It is a command line interface, like bash.)

Run a Single Clojure File

Clojure Tutorial: Run/Execute One Clojure File

Reference

http://clojure.org/repl_and_main