Liking cljdoc? Tell your friends :D


CircleCI Build status Clojars Project

Clojure provides the clojure command line tool for:

  • Running an interactive REPL (Read-Eval-Print Loop)
  • Running Clojure programs
  • Evaluating Clojure expressions

The clojure tool is written in bash. This is a port of that tool written in Clojure itself. It comes in two flavors:

  • as a script: deps.clj
  • as an executable: deps.exe


Linux and macOS:

$ bash <(curl -s
$ deps.exe
Clojure 1.10.1


C:\> PowerShell -Command "iwr -useb | iex"
C:\> deps.exe
Clojure 1.10.1


Reasons why I made this:

  • The port was done as proof of concept for babashka. The entire bash script was ported to Clojure successfully and runs just as fast with bb.

  • This offers an arguably easier way to get going with deps.edn based projects in CI. Just download an installer script, execute it with bash or Powershell and you're set. Installer scripts are provided for linux, macOS and Windows.

  • Windows users might find the deps.exe executable of value if they have trouble getting their system up and running. It works with cmd.exe unlike the current Powershell based approach.

  • This repo might be a place to experiment with features that are not available in the original clojure command. Most notably it offers an -Scommand option which allows other programs to be started than just the JVM version of Clojure, e.g. babashka or planck.

  • Arguably bash and Powershell are less attractive languages for Clojure developers than Clojure itself. This repo provides the clojure bash script as a port in Clojure. It can be used as a binary, script (deps.clj), uberjar or library.

  • This repo can be seen as a proof of concept of what is possible with GraalVM and Clojure.


Experimental, but in a usable state. Breaking changes might happen to the non-standard functionality. Feedback and PRs are welcome.


There are three ways of running:

  • as a compiled binary called deps.exe which is tailored to your OS
  • as a script file called deps.clj using bb or clojure


The binary version of deps.clj, called deps.exe, only requires a working installation of java.

Manual download

Binaries for linux, macOS and Windows can be obtained on the Github releases page.

Linux and macOS

Install using the installation script on linux or macOS:

$ bash <(curl -s /tmp
$ /tmp/deps.exe
Clojure 1.10.1


On Windows you might want to install deps.clj using scoop.

Alternatively you can install deps.exe using by executing the following line:

C:\> PowerShell -Command "iwr -useb | iex"
C:\> deps.exe
Clojure 1.10.1

It's automatically added to your path. In Powershell you can use it right away. In cmd.exe you'll have to restart the session for it to become available on the path.

When you get a message about a missing MSVCR100.dll, also install the Microsoft Visual C++ 2010 Redistributable Package (x64) which is also available in the extras Scoop bucket.


The script, deps.clj, requires a working installation of java and additionally bb or clojure.

It can simply be downloaded from this repo:

$ curl -sL -o /tmp/deps.clj
$ chmod +x /tmp/deps.clj
$ bb /tmp/deps.clj
Clojure 1.10.1

Tools jar

This project will look in $HOME/.deps.clj/ClojureTools for clojure-tools.jar. If it cannot it find it there, it will try to download it from this location. You can override the location of the jar with the CLOJURE_TOOLS_CP environment variable.

Non-standard options

The deps.clj script adds the following non-standard options:

 -Sdeps-file    Use this file instead of deps.edn
 -Scommand      A custom command that will be invoked. Substitutions: {{classpath}}, {{main-opts}}.


One of the use cases for deps.clj is invoking a different command than java.

Given this deps.edn:

  {:extra-paths ["test"]
   :extra-deps {borkdude/spartan.test {:mvn/version "0.0.4"}}
   :main-opts ["-m" "spartan.test" "-n" "borkdude.deps-test"]}}}

you can invoke bb like this:

$ deps.clj -A:test -Scommand "bb -cp {{classpath}} {{main-opts}}"
Ran 3 tests containing 3 assertions.
0 failures, 0 errors.

If you use -Scommand often, an alias can be helpful:

$ alias babashka='rlwrap deps.clj -Scommand "bb -cp {{classpath}} {{main-opts}}"'
$ babashka -A:test
Ran 3 tests containing 3 assertions.
0 failures, 0 errors.

Additional args are passed along to the command:

$ babashka -e '(+ 1 2 3)'

Note that we included rlwrap for a better REPL experience. Of course you can create another alias without rlwrap for CI:

$ alias bbk='deps.clj -Scommand "bb -cp {{classpath}} {{main-opts}}"'

This approach can also be used with planck or lumo:

$ alias lm='deps.clj -Scommand "lumo -c {{classpath}} {{main-opts}}"'
$ lm -Sdeps '{:deps {medley {:mvn/version "1.2.0"}}}' -K \
  -e "(require '[medley.core :refer [index-by]]) (index-by :id [{:id 1} {:id 2}])"
{1 {:id 1}, 2 {:id 2}}


The -Sdeps-file option may be used to load a different project file than deps.edn.


Copyright © 2019 Michiel Borkent

Distributed under the EPL License. See LICENSE.

This project is based on code from clojure/brew-install which is licensed under the same EPL License.

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close