Skip to content
Latchkey

Clojure CLI "clojure: command not found" in CI

The clojure and clj launchers come from the Clojure CLI (tools.deps) install, which is separate from Leiningen and from the JDK. If the runner never installed it, any clojure -M or clj command fails immediately.

What this error means

A step running clojure -M:test or clj -X:build fails with "clojure: command not found" and exit code 127.

clj
/home/runner/work/_temp/script.sh: line 1: clojure: command not found
Error: Process completed with exit code 127.

Common causes

The Clojure CLI is not installed

The runner has a JDK but no tools.deps launcher, and no setup step provisions it.

A confusion between lein and the CLI

The project uses deps.edn and expects clojure/clj, but the workflow only installed Leiningen (or the reverse).

How to fix it

Install the Clojure CLI with a setup action

Provision the CLI (and a JDK) so clojure and clj are on PATH.

.github/workflows/ci.yml
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '21'
- uses: DeLaGuardo/setup-clojure@13.0
  with:
    cli: latest

Install the CLI with the official script

Run the linux installer, then confirm the launcher works.

Terminal
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
chmod +x linux-install.sh && sudo ./linux-install.sh
clojure --version

How to prevent it

  • Install the tool your project actually uses (CLI for deps.edn, lein for project.clj).
  • Pin the setup action and CLI version.
  • Verify with clojure --version before the build steps.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →