Fork me on GitHub

So...I asked about this over a year ago when I was trying to install Clojure on a different machine. Here I am again and the linux-install method here still doesn't work??


I run these commands, as specified:

curl -O 
chmod +x
sudo ./
and then I get the following error on the last command: Downloading and expanding tar % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 16.9M 100 16.9M 0 0 8982k 0 0:00:01 0:00:01 --:--:-- 8980k /usr/bin/gzip: 1: ELF: not found /usr/bin/gzip: 3: : not found /usr/bin/gzip: 4: Syntax error: "(" unexpected tar: Child returned status 2 tar: Error is not recoverable: exiting now


That's... how I install it. What shell are you using?


what happens when you try to run gzip by itself?


I'm not super familiar with WSL, but maybe all of the expected prerequisites aren't there?


does the following work?

$ echo 'hi' | gzip | gzip -d


How does one report to the maintainers of that Clojure installation guide that there may be an issue with it? Clearly they have updated the clojure-tools version between early 2021 and now, so the guide is being looked after, but somehow it just still doesn't work (at least for me, on a freshly installed WSL/WSL2!).


...and is there some way to get that method working?


Well, I did check and see that despite my efforts to get WSL2 going, it was still on WSL1, so I uninstalled Linux (Ubuntu 22.04 LTS), ran wsl --set-default-version 2 in PowerShell, and reinstalled Ubuntu 22.04 (from MS Store). Then I installed java (openjdk11) and rlwrap and I verified that bash and curl were pre-installed, as per ...and this time around, when I run the three commands

curl -O 
chmod +x
sudo ./
...I still get an error after the last command, but this time around it's just sudo: ./ command not found This doesn't feel like progress. 😞


In the same terminal, without running anything after the sudo, what does ls -la ./ show?


It sounds like setting the execute bit (the chmod command) didn't happen


The ls command above will show what the permissions are on the file and if the execute bit is set


If I try to run that last command without sudo I get a different error: $ ./ -bash: ./ Permission denied it seems to be confused by 'sudo'. So anyway, why would that real command from the Clojure guide, sudo ./ , yield sudo: ./ command not found ?


OK...answered my own question! facepalm When it came to the 2nd of the 3 commands, chmod +x, I wanted to know what that command did, so I tried running it without the +x hoping it would show me the original state of whatever file attributes chmod commands affect. (That didn't work, since as I later found out chmod doesn't work to see attributes, only change them, and ls is used to see them) Then when I wanted to run the original command, I filled in -x instead of +x , just because most switches I've ever used have been with minus symbols and not plus symbols!


After running the proper commands (with +x in the 2nd one), everything seems to be installed. I would still be interested in why the alternate method (via brow) was recommended to me last time instead of the linux-install method.


s/brow/brew? At a guess? Brew isn't maintained by the clj core team


@UH5SE3NM9 Homebrew or brew is a package manager that's more prevalent on MacOS and has a Linux version too Since the clojure brew tap is maintained and regularly updated every clojure release it's an easier option.


The same brew tap works for both mac and Linux, hence its a recommendation too, specially on developer machines. On Linux servers for example setting up brew is overkill and people generally use the install shell script.


OK, good to hear some other people actually use the linux-install method. I'll do that for now. ...and one day maybe I'll figure out what the advantages of brew would be.


Primary advantage there is you can run “brew upgrade” and it can go check for updates and install them. Similar to apt or some other package manager. Hence it's easier for dev machines, you don't have to find the install script and run it every time.


The shell script method is easier on servers as mostly we'd fix the version being installed and the script is invoked via some automation, generally not a human.

Drew Verlee14:07:02

While we're on the topic, im used to apt-get installing packages. Why wouldn't they be the default way on Linux?


yeah it should work on debian based ones, but then everyone isnt on those


also they update at a slower pace that the official releases, i guess thats why it isnt recommended maybe?


apt clojure is still at 1.10 i think


@U0DJ4T5U1 Also a lot of these package manages for Linux tend to require "build from source" for distributions and building all of the pieces to make Clojure's CLI completely installable from source is very hard (it depends on tools.deps which depends on Clojure itself which depends on spec which also depends on Clojure so you end up having to bootstrap it all from an old version of Clojure pre-spec I think).

👍 1

@UH5SE3NM9 FWIW, I use brew on Linux because it makes it easy to upgrade regularly and also to keep lots of different versions installed so I can easily switch between them for testing.


Versions I have installed for testing:

seanc@Sean-win-11-laptop:~/oss/next-jdbc$ ls -d /home/linuxbrew/.linuxbrew/Cellar/clojure*
/home/linuxbrew/.linuxbrew/Cellar/clojure              /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]   /home/linuxbrew/.linuxbrew/Cellar/[email protected]
/home/linuxbrew/.linuxbrew/Cellar/[email protected]  /home/linuxbrew/.linuxbrew/Cellar/[email protected]


Which reminds me I haven't installed 1149 on this machine (I have it on my main dev machine).

👀 1
Drew Verlee21:07:31

Thanks for the info. I'll have to think about that, I guess i don't have a good conceptual model for linuxbrew vs apt-get install. I just do what the instructions say most of the time 🙂 .


what is the best way to go from a maven pom file to deps.edn or project.clj?


The Clojure CLI (and tools.deps) can use pom.xml directly. What is your use case / problem?


That is exactly what I am looking for. Is there an example or documentation?


In my case, I did not write the maven pom file. I would like to generate a deps.edn file from the POM file because I will want to add things via deps.edn rather than thd pom


the pom file has deps that serve as a starting point


It's probably mentioned in the official deps and CLI docs on -- but probably only in passing that deps have to be deps.edn or pom.xml or via git?


And that may only be true for dependencies, not the primary project but you could use :local/root "." I suspect from the command-line...


Then you could probably use -Stree to visualize the deps more easily and take the top level of that and make deps.edn from it...? Depending on how complex the pom.xml file is, it may be easier/faster to just write deps.edn yourself...


hmmm, was hoping for an easy one-liner to convert pom to deps.edn


None that I know of...


There's a one-liner to create/update pom.xml from a deps.edn file, but not the other way around.


I haven't followed clj details in a bit so will likely need to get up to speed on cli first then


yeah, I am seeking the opposite direction, from POM to deps


Why does the project have pom.xml and not a Clojure deps file (either deps.edn or project.clj) in the first place?


it might be easier to just declare a folder containing that pom as a local/root? I think you could get it for free that way. Presumably you just want all that stuff on the classpath so you can get a repl going?


Yeah, that's why I suggested the :local/root approach above...


A Java person handed me a pom file


ah missed it. sorry both of you


thank you this is all useful info, but I will need to read up on the docs


Probably the easiest thing is to create a simple project (say with deps-new), create a java-lib folder in it and copy the pom.xml file there, then add a dep of java-lib/java-lib {:local/root "java-lib"} to the project deps.edn and you should be off to the races.

👍 1

That should at least let you get a REPL up and running as Dan suggested.


awesome! many thanks!!


one other thought, not sure if i’ve seen it mentioned, if you can get your hands on a jar this all goes away. just use the jar. clj -Sdeps '{:deps {:local/root "location/lib.jar"}}

💯 1

btw, this is excellent, thanks again!!


thanks again to you both