Fork me on GitHub

I think it can. Homebrew's first platform was macOS, I believe, where ruby has been installed by default since a long time ago (although I hear that might be changing in the latest macOS just released? Or perhaps the next one?)


And probably if I had done a non-minimal install of Ubuntu 19.04 Linux, it might have included ruby as well. In any case, sudo apt-get install ruby definitely works if you do that before brew install clojure. It seems that the main Homebrew install instructions for Linux work without ruby being installed first, surprisingly enough.


I just tried install Homebrew on WSL based on and the first thing it did was install Ruby...


(but it might be an "embedded" Ruby for its own use?)


Ruby got installed after you did only this command? sh -c "$(curl -fsSL )" ?


I will test on a fresh Linux VM and look at what happens a little more carefully while installing Homebrew.


Yeah, just confirmed it's an internal version of Ruby, just to run Homebrew! 😐


Hmm, and to get Ruby you need patchelf which in turn requires Clang / gcc... OK, not going down that rabbit hole! 🙂


So, could Clojure's brew recipe use something other than Ruby to do that textual change in the script?


Even a minimal Ubuntu 19.10 Linux install includes gcc, and I remember brew installation installed patchelf early on before.


This is an earlier Ubuntu from an early WSL1 install (the joys of Insider builds)


(This is on my Mac running Win10 via Parallels with WSL as just a testing ground... maybe later I'll try it on my Win10 laptop although that's also WSL1 but I use it a lot more there... on this machine, I use Mac's Terminal for all my work)


Although on Windows now I'm using Scoop to install Clojure etc in PowerShell


I believe I have followed the Homebrew Linux install instructions faithfully, and while it does install a ruby executable, it seems to be in a directory that does not end up on your command PATH after following the instructions, but some other directory.


Right: > Yeah, just confirmed it's an internal version of Ruby, just to run Homebrew!


It seems that perhaps there ought to be a way (or perhaps already is?) for a Homebrew install script to access that internal version.


but that's a minor issue of polish, I think.


This looks like the only line that is problematic: -- if that used any low-level, guaranteed-to-be-installed command to change the text, it wouldn't need Ruby and it would work just fine.


Perhaps. It does appear that sed has a -i option on the couple of systems where I have checked, for easier overwrite-the-input-file-in-one-shell-command convenience.


Given that there's a cp just below it, why not use this directly sed "s;PREFIX;$prefix;" < clojure > $prefix/bin/clojure


So it would be

mkdir ...
sed ...
cp ...


I don't see much reason to modify the installed source files in place.


(I'll be interested to hear Alex's thoughts on this tomorrow)

Alex Miller (Clojure team)03:10:22

sed has incompatible syntax between Mac and Linux


It's the -i flag that's incompatible. You can easily avoid it.

Alex Miller (Clojure team)03:10:20

If you can make it work, patch wanted


Any doc page you would recommend on how to test modifications to a Homebrew install script?


I have tested on a Linux machine using brew install --interactive clojure where I edited the script to replace ruby with ${HOMEBREW_RUBY_PATH}, and that worked. It used the Homebrew-internal installation of ruby. I will try that on a macOS system next to see if it works there, too.


Yep, worked on a macOS system, too. That shell variable ${HOMEBREW_RUBY_PATH} was the full path name to a Homebrew-internal ruby executable on both a Linux system that had no other ruby installed, as well as on a Mac that had /usr/bin/ruby preinstalled before Homebrew was installed.


I created a PR, even though they are likely not accepted for this project, just one convenient way to show the suggested change: . Feel free to close it.


I think "brew-install" in the project name is a misnomer, and is expected to work on Linux sans homebrew


The script that my PR suggests changing appears to be identical to a file with the same name that I found in both a Mac and Linux Homebrew installation when I installed the clojure Flask.


The line my PR suggests changing is the one that was failing on a Linux system with no ruby executable.


I mean, I am fairly new to this Homebrew stuff, so could be making any number of mistaken assumptions here, but giving it a shot.


Sure, and it is also, unless I am mistaken, identical to which is used for installing on Linux systems which do not use homebrew


There is another file named in the same directory of that repo with, which uses install commands, that I suspect might be the non-Homebrew Linux install script.


Ah, my mistake


Always glad for another mind on the problem, though. Thanks for looking into it.


I use Linux as my desktop os, and the idea of using homebrew to manage installed packages is so alien to me. I would consider just making the homebrew script exit with an error suggesting using the Linux install script on Linux. In which case you could depend on the bsd sed options and wouldn't need Ruby. But that is maybe a terribly unfriendly idea.

👍 4

The script works fine on macOS already today, since /usr/bin/ruby comes preinstalled (until either Catalina, I think, or maybe the next macOS release, when I have read it will no longer come preinstalled). With this change, it should continue to work on macOS, and start working on Linux. That doesn't mean anyone must use Homebrew on Linux -- just another option.


I would just not sed in place, and use it to write elsewhere.


-i is just a convenience flag with sed


how to add a repository in deps.edn?


There's a :mvn/repos key


since upgrading to clojure (from clojure fails to run


$ clojure
Error: Could not find or load main class clojure.main
$ clojure -Spath
Error: Could not find or load main class clojure.main


$ brew info clojure
clojure: stable
The Clojure Programming Language

/usr/local/Cellar/clojure/ (9 files, 21.1MB) *
  Built from source on 2019-10-19 at 20:39:17
==> Dependencies
Required: rlwrap ✔
==> Requirements
Required: java >= 1.8 ✔
==> Analytics
install: 3,096 (30 days), 11,637 (90 days), 49,842 (365 days)
install_on_request: 3,070 (30 days), 11,511 (90 days), 49,114 (365 days)
build_error: 0 (30 days)


any body else having issues like this?


Have you wiped your .m2?


(I'm not suggesting you should)


no, I didn’t


I just tried to move .clojure/deps.edn somewhere else, suspecting a problem with it. but then I get:


$ clj
cp: PREFIX/example-deps.edn: No such file or directory


with an ~/.clojure/deps.edn file only containing {} I guet the same Error: Could not find or load main class clojure.main error


since the -m flag of the java call was changed in this release, I suspect that this would be the problem:


I don't think it is. I think your install failed.


Given that you have issues with PREFIX


yes, you’re right


tried to reinstall already, but no luck


Ruby powers the rewrite on Mac, that's all I know I'm afraid. Maybe there's a log somewhere?


woudn’t know where to look for a log


It'll be a brew install log I'd guess.


ok, so I manually fixed the install_dir= in /usr/local/bin/clojure and it works now, let’s see if this is only a problem with my machine or if some body else runs into it


for future reference: macOS 10.15 (19A583),

$ ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
brew config


ok, found the logs and this also explains it:


$ cat ~/Library/Logs/Homebrew/clojure/ 
2019-10-21 12:50:08 +0200


truffleruby: the -p option is not implemented


Haha. Yes it does :)


@dominicm thanks for keeping company and pointing me in the right direction

Alex Miller (Clojure team)12:10:34

Ok, so is there something to fix here or is this an issue mainly on your system?


The problem is that truffle ruby is installed, and that didn't support -p for doing the substitution. Anyone who's playing with graal may run into this.

Alex Miller (Clojure team)13:10:51

so the prior discussion here about using the brew install ruby impl would presumably also address that


Yes. So would switching to sed.

Alex Miller (Clojure team)13:10:33

-i has different incompatible syntax on mac and linux there

Alex Miller (Clojure team)13:10:45

I used to use sed, then perl for a bit


I know. But you can avoid using -i

Alex Miller (Clojure team)13:10:30

I seem to remember there was some reason I didn't do that either, but it was a long time ago now


Probably not a problem. Using brew means ruby anyway. The only impetus would be to unify the install scripts.


unfortunately some distros have stopped including ed... echo -e 'w clojure.bak\n1,$s^PREFIX^'$PREFIX'^\nwq' | ed clojure


I remember I once proposed a sed command which worked on linux and macos, but either my mind or jira search fails me


This is exactly the same problem I found on Linux with Homebrew with no Ruby preinstalled. This will be an issue for all macOS Catalina systems, too, which also have no ruby preinstalled for the first time with macOS since it was introduced almost 20 years ago.


but Dominic is right, using brew means using ruby, so I guess it makes sense to be able to rely on ruby


There is an issue open for Homebrew for this since June 2019 I found last night.


I believe that the patch I submitted for the Clojure Homebrew installer will work for Catalina as well, because it will force the Clojure to use a ruby installed inside of Homebrew, rather than a system-wide one.


But I do not have a macOS Catalina system to test on to be certain.

Alex Miller (Clojure team)13:10:19

well, that certainly bumps it up my priority list


Does anyone know if the immutant folks intended to let their domain expire? When I go to there's just a domain expiration notification.


This probably isn't the channel for that. @U06SGCEHJ you're associated I think?

Alex Miller (Clojure team)15:10:45

definitely not the channel, but I'm not sure anyone is still working on immutant


Ok, thanks for the info. I'll see if there's a better place.


Oh, I just noticed I posted this in tools-deps, not clojure. Sorry!

Alex Miller (Clojure team)15:10:15

tools.deps.alpha 0.8.578, clj are now available - see #announcements for details

Alex Miller (Clojure team)15:10:06

as a side note, there were changes made to the internal cli scripts between clj and tools.deps ( and I doubt many people use any of that directly, but changes were made in and to avoid any breakage.


Is anyone successfully using (add-lib ...) in a Cursive repl? I get a true back, but then "could not locate ... on classpath" when requiring the lib.


@alexmiller The new :deps and :paths support in aliases is interesting. Am I correct in thinking that this would allow overriding the system deps.edn, e.g. to use a fork of Clojure?

Alex Miller (Clojure team)22:10:19

It still has install deps on the chain

Alex Miller (Clojure team)22:10:34

So, no difference there


I see. Yes, re-reading the announcement I see I misread it - it’s more for tools to not require the project classpath instead.