These instructions are an amplification and some corrections (due to changes in standard Clojure distributions) on Mark Reid’s instructions, with a nod towards Ken Sipe). This will get you a Clojure 1.2 command line prompt.
First, create a directory for Clojure.
mkdir -p ~/Library/Clojure/lib
Second, download the core Clojure and Clojure contrib, and JLine packages.
mkdir -p ~/Library/Clojure/tmp
cd ~/Library/Clojure/tmp
wget --no-check-certificate https://github.com/downloads/clojure/clojure/clojure-1.2.0.zip
wget --no-check-certificate http://github.com/downloads/clojure/clojure-contrib/clojure-contrib-1.2.0.zip
wget http://downloads.sourceforge.net/jline/jline-0.9.95.zip
Third, unzip these, and put the jar files into the lib directory.
unzip clojure-1.2.0.zip
unzip clojure-contrib-1.2.0.zip
unzip jline-0.9.94.zip
cp clojure-1.2.0/clojure.jar ~/Library/Clojure/lib/clojure.jar
cp clojure-contrib-1.2.0/target/clojure-contrib-1.2.0.jar ~/Library/Clojure/lib/clojure-contrib.jar
cp jline-0.9.94/jline-0.9.94.jar ~/Library/Clojure/lib/jline.jar
If you like, you can delete the tmp directory created above.
Fourth, create a clj command and place it somewhere in an executable location.
It should look something like this (mostly like Ken Sipe’s command).
!/bin/bash
Runs Clojure using the classpath specified in the .clojure
file of the
current directory.
Will Fitzgerald 2011-01-18, based on:
Ken Sipe 2010-02-20,
Inspired by Mark Reid
Sipe's code:
http://kensipe.blogspot.com/2010/02/setting-up-clojure-110-on-mac-osx.html
original: http://github.com/mreid/clojure-framework/blob/e1c80cc650f448713243be8272dba1fa3c1a7cea/clj
#
This scripts expects java to be define.
clojure.jar, clojure-contrib.jar, and jline.jar should be in
~/Library/Clojure/lib
CLOJURE_HOME=~/Library/Clojure/lib CLJ_DIR=$CLOJURE_HOME CLOJURE=$CLJ_DIR/clojure.jar CONTRIB=$CLJ_DIR/clojure-contrib.jar JLINE=$CLJ_DIR/jline.jar CP=$PWD:$CLOJURE:$JLINE:$CONTRIB
Add extra jars as specified by .clojure
file
if [ -f .clojure ]
then
CP=$CP:cat .clojure
fi
if [ -z "$1" ]; then java -server -cp $CP jline.ConsoleRunner clojure.main else java -server -cp $CP clojure.main -i $* fi
You should now be able to execute clj or clj some.clj.