Scripts and notes on how I set up my Clojure working environment
Shell Clojure
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits ahead of mreid:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Clojure Framework

My set up for Clojure on Mac OS X Leopard.

Set Up Instructions

I've detailed much of this set up in a blog post but here's the short, command-line by command-line version:

Clone a copy of this project to your ~/Library/ directory:

$ cd ~/Library
$ git clone git:// Clojure
$ cd Clojure

Create a directory lib:

$ mkdir -p ~/Library/Clojure/lib

Grab the latest release of Clojure and put the jar in the lib directory:

$ curl > /tmp/
$ unzip /tmp/ -d /tmp/
$ cp /tmp/clojure/clojure.jar lib/

Next, get JLine to make Clojure's interactive mode nicer:

$ curl > /tmp/
$ unzip /tmp/ -d /tmp/
$ cp /tmp/jline-0.9.94/jline-0.9.94.jar lib/jline.jar

JLine 1.0 is also availalbe to use with the REPL and can be downloaded from the same location as JLine 0.9.94

Make the clj script executable and link to it from somewhere in your $PATH. (I use ~/bin and have added it to my $PATH in my ~/.bash_profile):

$ chmod u+x clj
$ ln -s ~/Library/Clojure/clj ~/bin/clj

This next steps are optional. Only do them if you want to use libraries from clojure-contrib:

$ git clone git:// /tmp/contrib
$ cd /tmp/contrib
$ ant -Dclojure.jar=$HOME/Library/Clojure/lib/clojure.jar
$ cp clojure-contrib.jar ~/Library/Clojure/lib/


The clj command can be used to open an interactive session:

$ clj

or it can be used to run a script:

$ clj test.clj 
Hello, Clojure!

To add extra jar files to the Clojure's classpath on a project-by-prject basis, just create a .clojure file in the project's directory with the text to add to the classpath.

For example, in my ~/code/clojure/cafe project directory, I can add the Grinder and Frother jars from the ~/code/clojure/cafe/lib directory by putting their relative paths, separated by a colon, into a .clojure file:

$ cd ~/code/clojure/cafe
$ echo "lib/grinder.jar:lib/frother.jar" > .clojure