Setting up OS X for Clojure Development

Developing in clojure is an absolute pleasure, however setting it up is rarely as easy. In this guide I will take you through the steps to get OS X up and running with Clojure and Leiningen (the Clojure build system).

Install Macports

Macports is a great package manager for OS X, it has all you need to get up and running. Install Macports from here

Install Clojure

To install clojure you need to run this as root:

sudo port -R install clojure

When you run that you will be asked for your password, after that it will automatically install. The -R will upgrade any dependencies too, just to keep things tidy.

Install Leiningen

Leiningen is the build tool for clojure, like maven is for java. In fact it even plays nicely with maven! Install it as such:

sudo port -R install leiningen

Once its installed it comes with a 2nd step you need to run:

lein self-install

Test your work

After which you are done. We’re going to test this by creating a new project using leiningen and proving the template tests fail as they are designed to do.

lein new testing
cd testing
lein test

If you see the line:

FAIL in (replace-me) (core.clj:6)

Then you have a working setup, welcome to the world of clojure!

3 thoughts to “Setting up OS X for Clojure Development”

Leave a Reply