Published on

Setting Up Clojure on Ubuntu

Authors

I started playing around with Clojure today. To install it was super easy although I did run into issues with the newest version of Lein. Lein is the project management tool for Clojure think npm or maven but for Clojure. It also includes things like a repl and a bunch of other capabilities that significantly improves the development experience.

To install Lein and Clojure simply follow the Lein install guide on the Lein site:

  • Download the Lein script to somewhere on your path for example ~/bin:
cd ~/bin && wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
  • Chmod the script to make it executable:
chmod a+x ~/bin/lein
  • Run lein:
lein
  • Test the installation was successful by running the repl:
lein repl

If all went successfully you should be in the Lein repl. If you run into an issue that starts with:

`Exception in thread "Thread-1" java.lang.AssertionError: Assert failed: transport-fn`:

You may be running into a bug with the newest version of Lein. To fix this:

  • Remove the old Lein version:
rm -fr ~/.lein
  • Update the version number in the Lein script, look for the line that starts with:
export LEIN_VERSION="2.8.2"
  • Change this to the version you need, in my case I changed this to 2.8.1

  • Install Clojure and Lein using:

lein
  • Confirm all is in order by running the repl:
lein repl