Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
clj is a Clojure REPL and package management system.
branch: master

This branch is 45 commits behind liebke:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
script
src/clj
.gitignore
README.textile
project.clj

README.textile

Clj is a Clojure REPL and package management system. It’s designed to complement the project-oriented approach of dependency management systems like Leiningen and Maven, both of which are my preferred tools for managing traditional-project dependencies. However, much of what I use Clojure for, including Incanter-based data analysis, is not really project-oriented. In these cases, it is more convenient to have access to a REPL (and Swank server) backed by a global package-management system.

Another goal of the clj project is to improve the out-of-box experience for Clojure. There are many approaches to helping people get started with Clojure, from the streamlined starter-pack called Dejour, which only includes Clojure and Clojure-contrib, to the full-monty approach of labrepl, which includes several additional Clojure libraries, instructions for configuring every available Clojure IDE plugin, and web-based Clojure tutorials.

Clj takes a third approach by providing an easy to launch REPL combined with the ability to easily search for and install Clojure packages from the Clojars repository.

Clj uses Leiningen to manage the packages in the .clj repository, and there is a project.clj file in the .clj directory that can be customized by hand if desired.

Quick start

Install

  1. Download http://incanter.org/downloads/clj-1.0.0-SNAPSHOT-standalone.jar
  2. Run java -jar clj-1.0.0-SNAPSHOT-standalone.jar self-install
  3. Copy ~/.clj/bin/clj(.bat) to your path

Try it out

  1. Run clj list to see what packages are installed.
  2. Run clj search compojure to search for Compojure on Clojars.
  3. Run clj describe compojure to get a description of the latest version of compojure.
  4. Run clj install compojure to install the latest version of compojure.
  5. Run clj repl or clj swingrepl to launch a REPL configured for all the installed packages.

Documentation

Usage: clj command [arguments]

Available commands

  • repl: Starts a Clojure repl.
  • swingrepl: Starts a Clojure swingrepl.
  • swank [port]: Start a local swank server on port 4005 (or as specified).
  • run filename: Runs the given Clojure file.
  • list: Prints a list of installed packages.
  • search term: Prints a list of packages on clojars.org with names that contain the given search term.
  • install package-name [package-version]: Installs the given package from clojars.org, defaulting to the inferred latest version.
  • describe package-name [package-version]: Prints the description of the given package as found in the description field of its pom file.
  • versions package-name: Prints a list of the versions of the given package available on clojars.org
  • remove package-name: Removes given package from the clj-repo package list, must be followed by clj clean and clj reload to actually remove packages from the repository.
  • clean: Removes all packages from ~/.clj/lib directory.
  • reload: Reloads all packages listed by clj list.
  • classpath: Prints classpath.
  • add-classpath dir-or-jarfile: Adds directory or jar file to the classpath. Directories should have a trailing / to distinguish them from jar files.
  • remove-classpath dir-or-jarfile: Removes a directory or jar file from the classpath. Remember to include trailing / for directories.

Packages are installed in $HOME/.clj/lib, and can be used by applications other than clj
by including the jars in the directory on the classpath. For instance, to start a command line
REPL with jline, run the following command:

java -cp ~/.clj/lib/'*' jline.ConsoleRunner clojure.main

Installation
Download the clj.jar file (or follow the instructions below to build from source):

wget http://incanter.org/downloads/clj-1.0.0-SNAPSHOT-standalone.jar

and either double-click on the jar file to run self-install, or run the self-install command from the command line:

java -jar clj-1.0.0-SNAPSHOT-standalone.jar self-install

Self-install will

  • create a $HOME/.clj directory
  • initialize a local reposistory for Clojure packages in $HOME/.clj/lib
  • create the shell and Windows batch scripts,
    • $HOME/.clj/bin/clj
    • $HOME/.clj/bin/clj.bat

Alternative installation directories
You can provide alternative CLJ_HOME and USER_HOME directories by passing them as properties to the above java command.

For instance, the following command creates the .clj and Maven .m2 directories under C:\ on a Windows box (something I had to do since Windows had problems with my shared home under VMWare, \\vmware-host\…).

java -Duser.home=C:\ -jar clj-1.0.0-SNAPSHOT-standalone.jar self-install

clj scripts
Once installation is complete, you should either add $HOME/.clj/bin to your path, export PATH=~/.clj/bin:$PATH on Unix/Mac OS X, or move the platform-appropriate clj script to a directory on your path.

Build instructions

lein deps
lein uberjar
java -jar clj-1.0.0-SNAPSHOT-standalone.jar self-install

Copyright © 2010 David Edgar Liebke

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.