Fork me on GitHub

I'm a little fuzzy on the distinction between clj's -A and -M options. What exactly is a "main option" alias and how does it differ from normal aliases/"aliases of any kind"? (Side note: where did that diagram go with all the arrows labeled with the different CLI options? Could've sworn it was on the deps/cli reference page or the guide)


@ctamayo -A is for invoking a REPL, -M is for invoking clojure.main (typically with a -main function with :main-args), -X is for executing a function, typically with pre-configured args in deps.edn.

Alex Miller (Clojure team)20:02:03

the diagram was removed as it was mostly no longer correct


so -M:some-alias -m my.project a b c is like calling (my.project/-main a b c) right? And :some-alias presumably just adds extra stuff to the classpath that the my.project ns needs?


Thanks! OK so I think something weird is happening. This has happened once or twice before - I forget where - but most recently on the datahike test suite: Commands that are documented with -M fail with a FileNotFoundException, but succeed when I use -A instead. So for example running unit tests exactly as they are invoked by the helper scripts ( via gives me:

$ TIMBRE_LEVEL=':fatal' clojure -M:test -m kaocha.runner --focus :clj
Execution error (FileNotFoundException) at clojure.main/main (
Could not locate kaocha/runner__init.class, kaocha/runner.clj or kaocha/runner.cljc on classpath.
Full report at:
But switching to -A:test works.


@ctamayo That indicates the version of clojure is too old.


clojure -Sdescribe will tell you what version it is. You need at least per


ah, I was looking for a --version option or something. Good to know, thank you!


In older versions of clojure the -M option did not respect :extra-deps so part of the alias would not be pulled in (the dependencies), just the :main-opts part.


clojure -h displays the version (at the top of the help) as well as clojure -Sdescribe


not sure how I missed that at the top of clojure -h! Guess I need a break. 🧟


It scrolls off the top of the screen for me so I tend to recommend clojure -Sdescribe because the output is shorter.


I also had an embarrassingly old version ( that didn't print that at the top. But I will remember that trick! And also take a break still. 😛


Also worth noting that the latest is now that Clojure 1.10.2 is out (not 1.10.1.x).


yep, that is the one I just installed and it's working now!


Is there a way to find out which version of Jetty the installed Clojure tools are using?


@zane Jetty? I wouldn't expect the Clojure tools to be using a web server. Can you provide a bit more context?


If you mean "in a deps.edn project, where Jetty is a transitive dependency", you can use clojure -Stree