LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

clj

Clojure CLI with readline support

TLDR

Start REPL
$ clj
copy
Run script file
$ clj -M [script.clj]
copy
Execute function
$ clj -X [namespace/function]
copy
Add dependency alias
$ clj -A:[alias]
copy
List dependencies
$ clj -X:deps list
copy
Show dependency tree
$ clj -X:deps tree
copy
Run with extra JVM options
$ clj -J-Xmx[2g] -M [script.clj]
copy

SYNOPSIS

clj [clj-opts] [-M|-X|-T] [aliases] [args]

DESCRIPTION

clj is a wrapper around the clojure command that adds readline support via rlwrap, providing line editing, history, and completion in the REPL. It is the recommended way to start interactive Clojure development sessions.The tool manages dependencies through deps.edn configuration files and supports multiple execution modes for running programs, executing functions, and invoking tools. Aliases defined in deps.edn allow switching between different dependency configurations for development, testing, and production.For non-interactive use cases such as shell scripts and CI pipelines, use the clojure command directly instead, as rlwrap can interfere with piped input and output.

PARAMETERS

-A:aliases

Use aliases for deps/paths
-J opt
Pass option to JVM
-Sdeps edn
Override deps.edn
-Spath
Print classpath
-Scp cp
Use given classpath
-Sforce
Force classpath recomputation
-Srepro
Ignore user deps.edn
-Stree
Print dependency tree
-Sdescribe
Print environment info as EDN
-P
Prepare deps only, don't exec
-h, --help
Show help

CONFIGURATION

deps.edn

Project-level dependency declarations, aliases, and path configurations.
~/.clojure/deps.edn
User-level default dependencies and aliases applied to all projects.

EXECUTION MODES

-M

Use clojure.main, call -main function
-X
Execute function with keyword args map
-T
Like -X but classpath set to . only

BUILT-IN TOOLS

$ clj -X:deps list       # List all deps
clj -X:deps tree       # Dependency tree
clj -X:deps mvn-pom    # Generate pom.xml
copy

INSTALL

sudo dnf install clojure
copy
sudo pacman -S clojure
copy
sudo apk add clojure
copy
sudo zypper install clojure
copy
brew install clojure
copy
nix profile install nixpkgs#clojure
copy

CAVEATS

Requires deps.edn for project configuration. Use `clojure` instead of `clj` in scripts (no rlwrap). JVM options via -J or JAVA_OPTS env var.

SEE ALSO

lein(1), java(1), clojure(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid