2

I found the following guide:

http://mark.reid.name/sap/setting-up-clojure.html

but it seems like a whole lot of manual steps, and I bet it is out of date already. Installing ClojureBox on Windows was a breeze. Does anyone know of a simple installer for it? Where can I download it, and what are the steps?

Thanks!

EDIT: Tried installing cake, got:

$ sudo gem install cake
Password:
ERROR:  While executing gem ... (Gem::RemoteSourceException)
    HTTP Response 302

Also tried installing using the script:

$ sudo ./cake_install.rb 
http://github.com/ninjudd/cake-standalone/raw/master/jars/cake-0.5.4.jar
[=============================================================================]
http://build.clojure.org/releases/org/clojure/clojure/1.2.0/clojure-1.2.0.jar
[=============================================================================]
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file (ordered_set.clj:1)

EDIT 2: Now the Java version issues :) What version of Java do I need and where to download it?

$ sudo cake test
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file (ordered_set.clj:1)

My Leopard software is up to date :(

Apple Computer supplies their own version of Java. Use the Software Update feature (available on the Apple menu) to check that you have the most up-to-date version of Java for your Mac. If you have problems with downloading, installing or using Java on Mac, please contact Apple Computer Technical Support.

EDIT: Hm ... I suspect that one of the suggestions I tried broke my ability to connect to the internet (both wired as well as wireless) on Apple :(

Hamish Grubijan
  • 10,562
  • 23
  • 99
  • 147

7 Answers7

6

Clojure is also installable via Homebrew:

Adam Vandenberg
  • 19,991
  • 9
  • 54
  • 56
2

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)

  1. gem install cake

Standalone script

  1. Download the script
  2. Put it somewhere in your path and chmod +x cake to make it executable

Git repository

  1. git clone git://github.com/ninjudd/cake.git
  2. 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.

Alex Taggart
  • 7,805
  • 28
  • 31
  • Thanks, but I tried the first two methods and both failed. Please see my edit(s) an ask questions / offer suggestions. – Hamish Grubijan Oct 24 '10 at 04:21
  • Odd. What version of ruby do you have? I know it works on 1.8.7. While unlikely to be the cause, try running without sudo. – Alex Taggart Oct 24 '10 at 14:04
  • 1.8.7 | tried with and without | Looks like I need to upgrade gems http://help.rubygems.org/faqs/rubygems/why-do-i-get-http-response-302-or-301-when-installing-a-gem I am wondering though - how is Ruby involved in this? Is Clojure pretending to be a ruby package? – Hamish Grubijan Oct 24 '10 at 15:54
  • Cake is written in ruby, which then manages the persistent JVMs. As for java, clojure requires 1.5 which should already be in your Mac. – Alex Taggart Oct 24 '10 at 19:25
  • I believe one of these commands left my system in a bad state (cannot use network interface in any form). How can I undo/cleanup these commands? – Hamish Grubijan Oct 25 '10 at 22:13
2

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.

Philipp
  • 51
  • 4
  • 2
    On Mac OS X: 1. brew install clojure 2. brew install leiningen and then lein repl to run the repl. – jemeshsu Feb 21 '12 at 07:20
2

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.

Miki Tebeka
  • 13,428
  • 4
  • 37
  • 49
  • Would doing it this way screw up an existing Clojure installation? – Hamish Grubijan Oct 24 '10 at 15:59
  • Also, what version of Eclipse and Java do I want for this? – Hamish Grubijan Oct 24 '10 at 16:10
  • +1 for CounterClockwise - I find it is a great tool (largely because my coding is 75% Java so I need Eclipse, but want to write Clojure as well without switching to a different environment). I use Eclipse 3.6.1 with the latest stable CounterClockwise update from http://updatesite.counterclockwise.googlecode.com/hg/ – mikera Oct 24 '10 at 20:01
  • @Hamish - I don't think it will impact any other Clojure distribution, actually I think CounterClockwise even bundles a version of the Clojure jars to make things easy if you don't have another set of Clojure libraries handy. – mikera Oct 24 '10 at 20:03
  • I just use the eclipse that comes with Ubuntu, but my guess it's the "Eclipse IDE for Java Developers" on the download page. – Miki Tebeka Oct 25 '10 at 20:12
2

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?

John Lawrence Aspden
  • 17,124
  • 11
  • 67
  • 110
  • You'd need to uninstall maven, delete the maven local repository .m2, and then get emacs back into its previous state, probably by deleting the .emacs and .emacs.d file and directory tree and restoring them from backup. -- If you have an emacs setup that you're happy with and are worried about messing with then you should back it up before adding ELPA and installing the clojure related packages. -- In fact I would try it out on a new user account first and see if you like it all! -- I will add a note about this to the original article, since it would obviously be of concern to first-timers – John Lawrence Aspden Oct 27 '10 at 16:09
1

Install MacPorts and then run sudo port install clojure

greg
  • 4,843
  • 32
  • 47
0

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:

http://github.com/citizen428/ClojureX

Michael Kohl
  • 66,324
  • 14
  • 138
  • 158