← 返回命令列表

Linux command

clj 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start REPL

clj

Run script file

clj -M [script.clj]

Execute function

clj -X [namespace/function]

Add dependency alias

clj -A:[alias]

List dependencies

clj -X:deps list

Show dependency tree

clj -X:deps tree

Run with extra JVM options

clj -J-Xmx[2g] -M [script.clj]

说明

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.

参数

-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

FAQ

What is the clj command used for?

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.

How do I run a basic clj example?

Run `clj` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -A:_aliases_ do in clj?

Use aliases for deps/paths