Scripts and notes on how I set up my Clojure working environment
Pull request Compare This branch is even with carlism:master.
Latest commit 3ffc1d1 Jan 21, 2010 @citizen428 citizen428 committed with carlism Fixed formatting of ant build file
Failed to load latest commit information.
Clojure.tmbundle @ 689e399
clojure @ f4c58e3
clojure-contrib @ eb2ae1e
clojure-mode @ c8c684e
jline @ 4d2e4ba
slime @ e5257d7
swank-clojure @ d020202



Easy set up for Clojure on Mac OS X (Snow) Leopard.

NEW: Experimental support for Cygwin. See note.

Set Up Instructions

$ git clone git:// clojure
$ cd clojure

Grab all packages (clojure, clojure-contrib, jline and TextMate/Emacs support):

$ git submodule init
$ git submodule update

Build the packages:

$ ant

To create a symlink for the clj script in /usr/local/bin you can run the following command:

$ ./create_symlink

If you prefer to create the link somewhere else, you can do it manually like this:

$ ln -s <full path to this project>/clj <destination path>/clj

To setup support for TextMate, run the following command which creates a symlink to the bundle in ~/Library/Application\ Support/TextMate/Bundles/:

$ ./configure_textmate

If you prefer Emacs for Clojure development the following command will add the necessary configuration for clojure-mode, slime and swank-clojure to your ~/.emacs:

$ ./configure_emacs

Cygwin Users: Additional Instructions

Edit clj to point to your java binary. If JAVA_HOME is set, you can use the following:

JAVA=`cygpath -d "$JAVA_HOME"`/bin/java


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

$ clj

It can be used to run a script:

$ clj test.clj 
Hello, Clojure!

or it can be used to make a script file executable by starting your file with this line:

#!/usr/bin/env clj

then chmod u+x your file and run it.

You can also open a debug port like this:

# clj -d 1234 test.clj

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

If your project direectory is ~/code/clojure/cafe, you can add the Grinder and Frother jars from the ~/code/clojure/cafe/lib directory by putting their relative paths, separated by a colon, into the .clojure file:

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

You can also list jars one per line in the .clojure file, like so:

$ cd ~/code/clojure/cafe $ ls -1 lib/*.jar > .clojure

Staying up to date

Once you have a local checkout of ClojureX, it's easy to keep your Clojure installation up to date:

$ cd clojure
$ cd <submodule you want to update>
$ git pull origin master

To update the source for all submodules at the same time, you can issue the following command:

$ ./update_all

If there were any updates to clojure, clojure-contrib or jline you will have to rebuild them like this:

$ ant


  • Add scripts to work with Clojure projects after installation