Ambiguity in Clojure installation instructions

On the Homebrew formulae site—here—we see the “install command” as brew install clojure. The page links also to clojure.org, where when you navigate to “Install Clojure” (here), we see the “install command” as brew install clojure/tools/clojure.

So: in one place,
brew install clojure,
and in another,
brew install clojure/tools/clojure.

So which one is it? Anybody know?

I’m setting up a new laptop and it’s given me the opportunity to set up my Clojure workflow from scratch. This question I pose is one of those that make Clojure difficult for beginners, don’t you all agree?

1 Like

Follow the clojure.org instructions (brew install clojure/tools/clojure). Those are official and correct.

The homebrew instructions have been known to cause issues. The Clojure team has asked the homebrew folks to change the default tap, and the homebrew folks refused: https://groups.google.com/g/clojure/c/WI3ddZRK4Bg/m/xO56Lat3CgAJ

Clojure maintains its own brew tap and a “stable” release that you can obtain with brew install clojure/tools/clojure (the brew conventions automatically find the prior repo based on that). That tap also includes prerelease unstable versions that can be obtained with “@version” - more on that is doc’ed in the readme for that repo.

Homebrew core is what you are pulling from if you just do brew install clojure. The formula there is no longer maintained by the Clojure team as anyone can update it (and have, with changes we did not agree with). There is no “ownership” model in homebrew-core. I would happily remove it from there but they said they would not accept that PR. Recently, the homebrew-core formula has been updated by members of the homebrew team to newer prerelease (not yet stable) versions of clj. There is not really anything we can do about this.

(Emphasis mine.)

For what it’s worth, the official “Install Clojure” page links to an explanation saying basically the same thing:

This tap is the source of the official Clojure brew formula. The Clojure formula on homebrew-core is not the official formula and is likely to be out of date.

In general, Homebrew is a packaging & distribution tool for software created by others

Homebrew is not necessarily the owner of the software it packages so should never be seen as the canonical source of truth

Whist homebrew is a convenient tool for installing software on a Mac there is no guarantee that it follows the original owners recommendations or provides the correct version or solution

Any tool should be used with consideration

For anyone starting with Clojure, there are a wealth of resources at Clojure.org to help, so should be the official starting point

Just FYI, I do update the homebrew core tap which we do stable release builds to the Clojure tap, so either instruction should give you the same version of the Clojure CLI (modulo some brief in between time immediately after each release while the PR is considered). The formulae differ slightly, particularly in how they handle the jdk requirement but most people will not notice anything different.

So to summarize our talk so far, in using brew install clojure, you run two risks:

  • Some possible problem having to do with the classpath order.
  • That in certain occasions, brew install clojure/tools/clojure will install a more up-to-date version of Clojure (as the Homebrew tap’s update PR is being considered).

I wonder what classpath problems I might run into by using brew install clojure—I guess I’ll find out.

I don’t think you’ll run into any problems with classpath order, why do you think so?

hi @alexmiller,

i thought there was something having to do with classpath order which made brew install clojure/tools/clojure preferable to brew install clojure (cf the link which @dave.liepmann provided to the Google Groups discussion). but i don’t understand it.

as a beginner, i want to install Clojure using brew install clojure—that is to say, if this isn’t the “right way,” then man i wish it could be.

i thought there was something having to do with classpath order which made brew install clojure/tools/clojure preferable to brew install clojure

Nope, no difference, you are running the identical calculation either way.

as a beginner, i want to install Clojure using brew install clojure—that is to say, if this isn’t the “right way,” then man i wish it could be.

Well, it’s not a wrong way, it just levies some JVM requirements (for latest) that we disagree with.

I refreshed my memory on the classpath thing - at that time, the classpath order was not necessarily reproducible (code stuff depending on hashes in unordered maps could affect the final ordering). The version of clojure was just one of many arbitrary things that might have affected ordering (wasn’t really specific to the tap question).

But in any case, this is no longer arbitrary and the classpath should be reproducible per Clojure - Deps and CLI Reference (and the tap you install from is irrelevant, they install the same code for any given version).

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.