Paul Barry

Getting Started with Clojure and Aquamacs

July 2, 2008

I just posted a short screencast on how to get started with Clojure and Aquamacs:


One of the fun features of Clojure, or any Lisp I suppose, is the interactive development workflow. As you can see in the video, you write code by creating expressions that define functions and then you evaluate those functions in the REPL (Read-Eval-Print-Loop). You can redefine a function at any time. You can imagine that if you had a production system running, you could connect to it via a REPL or something like that, evaluate some expressions that redefine functions that contain bugs, and the system would be fixed with no downtime.

Here’s the contents of the ~/bin/clj script:




if [ -z "$1" ]; then 
	java -cp $JLINE_JAR:$CLOJURE_JAR jline.ConsoleRunner clojure.lang.Repl    
	java -cp $CLOJURE_JAR clojure.lang.Script $1




# Posted By Lombardi on Wednesday, July 2 2008 at 9:41 PM


Thanks for sharing this!

# Posted By David J. on Sunday, November 2 2008 at 7:19 PM


Very helpful. Thank you. Here is that customization.el snippet for your copy / paste pleasure:

(add-to-list 'load-path "~/clojure/clojure-mode")
(setq inferior-lisp-program "clj")
(require 'clojure-mode)
(setq auto-mode-alist
(cons '("\\.clj$" . clojure-mode)

(add-hook 'clojure-mode-hook
'(lambda ()
(define-key clojure-mode-map "\C-c\C-e" 'lisp-eval-last-sexp)))

Also, this may be an obvious point, but make sure the clj executable is in your path and properly CHMODed.

# Posted By JMan on Monday, November 3 2008 at 2:36 PM


Thanks Paul, works really well.

# Posted By Martin on Tuesday, November 25 2008 at 4:21 PM


Thanks a lot for this!

Btw, if you are running os x 10.4 (and git is somewhat a hassle to setup in that env.) you can get the latest tar here:


# Posted By Joubin on Monday, December 8 2008 at 10:27 PM


hi, so am trying to learn clojure and i've never used emacs before.
I followed the steps but i can get the REPL start in aquamacs.

When i open the helloworld.clj file i do see that aquamacs identifies the file as clojure file but C-c C-z does not launch the REPL.
Is there a step that i missed?

thanks a lot for the help

just to be sure i chmod clj to 777
clojure clojure-mode and jlime where installed in ~/src

# Posted By Adrien on Monday, February 1 2010 at 5:51 AM


Having trouble running this in Snow Leopard. I can launch a repl, but trying to ctrl-x ctrl-e on this s-expr:
(range 0 10)

gives this error:

Debugger entered--Lisp error: (void-function range)

It doesn't seem that it's running through clojure, but through elisp.

# Posted By Adam on Monday, May 17 2010 at 5:23 AM

Comments Disabled