Install MacPorts and then run sudo port install clojure
If you just want to run clojure programs, then macports works. Bear in mind you're dependent upon the maintainer to update versions.
If you plan on writing clojure programs, then cake is a better starting point. Installation involves one of the following (your choice):
Using gem (easiest)
gem install cake
Standalone script
- Download the script
- Put it somewhere in your path and
chmod +x cake
to make it executable
Git repository
git clone git://github.com/ninjudd/cake.git
- Symlink bin/cake into your path and make it executable
Cake is a full build system, but you can just use it to fire up the repl by running cake repl
. There's also leiningen, but starting repls will feel faster in cake since it uses persistent JVMs.
I find Leiningen very easy to use. Just download the script, put it somewhere in your $PATH (/usr/bin/ for example) and make it executable: sudo chmod +x lein
.
Now type lein repl
and Leiningen will download all the files you need and create a REPL for you. It's that easy.
You may want to check CounterClockWise (an Eclipse plugin). There's a video on how to install it here. It'll give you a lot of features to play with - including a clojure REPL.
Just checked this will still work under Ubuntu. It should be the same for macs, except using whatever macs use instead of apt-get to install maven:
http://www.learningclojure.com/2010/08/clojure-emacs-swank-slime-maven-maven.html
You need to install maven, create a file, then you can just call mvn clojure:repl and everything should just work.
If you'd also like the whole emacs-swank-slime setup that's also easy now, and described there.
If you try it can you comment back here or on the blog to let me know if there are any changes I need to make for macs?
Clojure is also installable via Homebrew:
- http://github.com/mxcl/homebrew
- brew install clojure
I once created a package called ClojureX that was partly based on Mark's article. It's not actively maintained anymore (at least not by me), but there's no reason it wouldn't work: