github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

citizen428 / ClojureX forked from carlism/Clojure-MacOSX

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 73
    • 3
  • Source
  • Commits
  • Network (3)
  • Issues (2)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (1)
    • 0.3.0
Sending Request…
Click here to lend your support to: ClojureX and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

An easy way to set up a full Clojure development environment on OS X — Read more

  cancel

http://citizen428.net/archives/390-Easy-setup-for-Clojure-on-Mac-OS-X-Leopard.html

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Fixed typo 
citizen428 (author)
Sun Jan 31 13:02:08 -0800 2010
commit  a80a2b9407deb917b7a1aeda83ba2f85ba6505bb
tree    ed35dedb5575880ea25a40b7fb0541b266f2926e
parent  3d7fd2648728005e39ed297cf0c411a51356f017
ClojureX /
name age
history
message
file .gitignore Sun Mar 29 05:28:43 -0700 2009 First commit [mreid]
file .gitmodules Tue Jan 12 17:21:24 -0800 2010 use a more updated tmbundle [shaug]
submodule Clojure.tmbundle - 689e399 Wed Jul 29 09:55:30 -0700 2009 Added textmate bundle [carlism]
file README.markdown Sun Jan 31 13:02:08 -0800 2010 Fixed typo [citizen428]
file build.xml Thu Jan 21 15:40:20 -0800 2010 Fixed formatting of ant build file [citizen428]
file clj Tue Jan 12 11:29:46 -0800 2010 update documentation and comments [shaug]
submodule clojure - b63af1a Sun Jan 17 02:48:01 -0800 2010 Updated submodule refs and README [citizen428]
file clojure-completions Sun Jan 10 23:13:30 -0800 2010 Several improvements to clj script * add supp... [Scott Haug]
submodule clojure-contrib - 39618b6 Sun Jan 17 10:03:01 -0800 2010 Merge remote branch 'shaug/master' [citizen428]
submodule clojure-mode - c8c684e Sun Jan 17 02:48:01 -0800 2010 Updated submodule refs and README [citizen428]
file configure_emacs Sat Oct 10 07:47:48 -0700 2009 Updated configure_emacs to make swank-clojure w... [citizen428]
file configure_textmate Sun Aug 23 14:48:23 -0700 2009 Added Emacs stuff (clojure-mode, slime and swan... [citizen428]
file create_symlink Sun Aug 23 14:48:23 -0700 2009 Added Emacs stuff (clojure-mode, slime and swan... [citizen428]
file generate_completions Sun Jan 10 23:13:30 -0800 2010 Several improvements to clj script * add supp... [Scott Haug]
submodule jline - 4d2e4ba Mon Jul 27 13:54:02 -0700 2009 Added modules, a build file, beginning docs, an... [carlism]
submodule slime - e6a02cf Sun Jan 17 02:48:01 -0800 2010 Updated submodule refs and README [citizen428]
submodule swank-clojure - d020202 Sun Jan 17 02:48:01 -0800 2010 Updated submodule refs and README [citizen428]
file test.clj Sun Jan 10 23:22:22 -0800 2010 a few fixes for test.clj * make it executable... [Scott Haug]
file update_all Tue Sep 08 03:16:08 -0700 2009 Added 'update_all' script and modified README t... [citizen428]
README.markdown

ClojureX

Easy set up for Clojure.

Supported Platforms

  • Mac OS X 10.5+
  • OpenSolaris
  • Linux (tested on Ubuntu 9.10)
  • Windows (Cygwin)

Set Up Instructions

$ git clone git://github.com/citizen428/ClojureX.git clojure
$ cd clojure

Grab all packages (clojure, clojure-contrib, jline and TextMate/Emacs support):

$ git submodule init
$ git submodule update

Build the packages with ant:

$ ant

If you want to build the JAR for swank-clojure for use in your own projects, you can do it like this:

$ cd swank-clojure
$ mvn jar:jar

To create a symlink for the clj script in /usr/local/bin you can run the following command:

$ ./create_symlink

If you prefer to create the link somewhere else, you can do it manually like this:

$ ln -s <full path to this project>/clj <destination path>/clj

Note: The clj script expects $JAVA_HOME in its environment. If $JAVA_HOME is not set, it will attempt to determine it for you. If for some reason you cannot provide $JAVA_HOME, you can set the $JAVA variable at the top of the clj script.

To setup support for TextMate, run the following command which creates a symlink to the bundle in ~/Library/Application\ Support/TextMate/Bundles/:

$ ./configure_textmate

If you prefer Emacs for Clojure development the following command will add the necessary configuration for clojure-mode, slime and swank-clojure to your ~/.emacs:

$ ./configure_emacs

Usage

The clj command can be used to open an interactive session:

$ clj
Clojure 1.1.0-master-SNAPSHOT
user=>

It can be used to run a script:

$ clj test.clj
Hello, Clojure!

Any options following the script will be passed as arguments to the script:

$ clj test.clj a b "c d"
Hello, Clojure!
Arg #1: a
Arg #2: b
Arg #3: c d

Use a shebang line at the start of your script to make a Clojure file executable:

#!/usr/bin/env clj

Of course, you'll also need to enable the script's execute mode (e.g., chmod u+x <scriptname>) to run it this way.

You can also open a debug port using the -d or --debug options:

$ clj -d 1234 test.clj

Additionally, the clj script supports all of clojure.main's command-line options. For example, to evaluate an expression, use -e or --eval. The script's value will be sent to standard output:

$ clj -e "(take 5 (iterate inc 0))"
(0 1 2 3 4)
$ clj --eval '(count "Hello, Clojure")'
14

Use the -i or --init option to evaluate a clojure script:

$ clj -i test.clj
Hello, Clojure

You can intermix the eval and init options multiple times, and they will be evaluated in the specified order:

$ clj -e '"Before test"' -i test.clj -e '"After test"'
"Before test"
Hello, Clojure!
"After test"

The clj script will exit immediate after processing all the init/eval options. Use -r or --repl to instead start an interactive session.

$ clj -e '"Starting my own REPL"' -r
"Starting my own REPL"
user=>

Finally, clj supports all of the java command line options to configure the JVM.

$ clj -d64 -Xms4g -Xmx4g -verbose:gc -i wf2.clj -e '(wf/wf-atoms "O.all")'

To see a full description of clj command-line options, pass it -?, -h, or --help

$ clj --help
Usage: clj ...

Working with Clojure

To add extra jar files to Clojure's classpath on a project-by-project basis, just create a .clojure file in the project's directory. Here's an example:

If your project directory is ~/code/clojure/cafe, you can add the Grinder and Frother jars from the ~/code/clojure/cafe/lib directory by putting their relative paths, separated by a colon, into the .clojure file:

$ cd ~/code/clojure/cafe
$ echo "lib/grinder.jar:lib/frother.jar" > .clojure

You can also list jars one per line in the .clojure file, like so:

$ cd ~/code/clojure/cafe
$ ls -1 lib/*.jar > .clojure

Staying up to date

Once you have a local checkout of ClojureX, it's easy to keep your Clojure installation up to date:

$ cd clojure
$ cd <submodule you want to update>
$ git pull origin master

To update the source for all submodules at the same time, you can issue the following command:

$ ./update_all

If there were any updates to clojure, clojure-contrib or jline you will have to rebuild them like this:

$ ant

Todo

  • Add scripts to work with Clojure projects after installation

Acknowledgements

  • Scott Haug for lots of new features for the clj script

  • Paul Rosania for adding Cygwin support

  • Dave Barker for adding debugging support (-d)

  • Carl Leiby for creating the Clojure-MacOSX project which is the base for ClojureX

  • Mark Reid on which Carl's work was based

  • Tim Riddel from whom I stole the contents of the .emacs file

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server