Repository navigation
Provide ruby.exe so it's a drop-in replacement for MRI #29
Description
Activity
Having a 64-bit jruby.exe launcher would also be valuable:
jruby/jruby#6042 (comment)@headius This became a problem again, see ruby/setup-ruby#18 (comment)
I'll copy the comments here for convenience:
Various issues here, once again with how to provide arubyalias forjrubythat works in both PowerShell and Bash:ruby -vin bash just fails on Windows if there is onlyruby.bat: https://github.com/eregon/setup-ruby-test/runs/433780474?check_suite_focus=truecp jruby.sh rubyfails because JRuby's.shlauncher is broken on Windows in JRuby 9.2.9.0: https://github.com/eregon/setup-ruby-test/runs/433786338?check_suite_focus=truecp jruby.exe ruby.exefails in PwSh: https://github.com/eregon/setup-ruby-test/runs/433787577?check_suite_focus=truecp jruby.bash rubykind of works but incorrectly deals with double quotes ("), which is fairly confusing: https://github.com/eregon/setup-ruby-test/runs/433791906?check_suite_focus=true
MRI handles the double quotes fine: https://github.com/eregon/setup-ruby-test/runs/433791899?check_suite_focus=true
Could we have a
ruby.exeor makecp jruby.exe ruby.exework?
.batfiles are ignored in Bash on Windows.
So I think only.exefiles work in both PwSh and Bash.- changed the title
[-]Provide ruby and ruby.bat so it's a drop-in replacement for MRI[/-][+]Provide ruby.exe so it's a drop-in replacement for MRI[/+]on Feb 8, 2020 Here are the executables provided on MRI built by RubyInstaller2:
$ ls -l rubyinstaller-2.5.7-1-x64/bin total 3.3M -rwxr-xr-x. 1 eregon eregon 4.8K Oct 2 00:54 erb -rw-r--r--. 1 eregon eregon 4.9K Oct 2 00:54 erb.cmd -rwxr-xr-x. 1 eregon eregon 546 Oct 2 00:54 gem -rw-r--r--. 1 eregon eregon 688 Oct 2 00:54 gem.cmd -rwxr-xr-x. 1 eregon eregon 190 Oct 2 00:54 irb -rw-r--r--. 1 eregon eregon 360 Oct 2 00:54 irb.cmd -rw-r--r--. 1 eregon eregon 729 Oct 2 00:54 rake -rw-r--r--. 1 eregon eregon 153 Oct 2 00:54 rake.cmd -rwxr-xr-x. 1 eregon eregon 938 Oct 2 00:54 rdoc -rw-r--r--. 1 eregon eregon 1.1K Oct 2 00:54 rdoc.cmd -rwxr-xr-x. 1 eregon eregon 188 Oct 2 00:54 ri -rw-r--r--. 1 eregon eregon 330 Oct 2 00:54 ri.cmd -rw-r--r--. 1 eregon eregon 694 Oct 2 00:54 ridk.cmd -rw-r--r--. 1 eregon eregon 870 Oct 2 00:54 ridk.ps1 drwxr-xr-x. 2 eregon eregon 4.0K Oct 2 00:54 ruby_builtin_dlls -rwxr-xr-x. 1 eregon eregon 35K Oct 2 00:54 ruby.exe -rwxr-xr-x. 1 eregon eregon 35K Oct 2 00:54 rubyw.exe -rw-r--r--. 1 eregon eregon 312 Oct 2 00:54 setrbvars.cmd -rwxr-xr-x. 1 eregon eregon 3.1M Oct 2 00:54 x64-msvcrt-ruby250.dllSo having a
ruby.exeseems the key.
Andcp jruby.exe ruby.exedoesn't work currently unfortunately.Is this only affecting Windows?
Most of the time we do not want to depend on the native launcher when the bash script works. If we could get rid of the native launcher we would, but it's needed on a few platforms (Darwin, Solaris) that don't support putting scripts into shebang lines.
FWIW I would be fine with JRuby publishing
rubyas the primary executable (bash or native) withjrubyjust a script that launches it. There's almost never a good reason to have bothjrubyand an unrelatedrubyin PATH.Yes, it's only on Windows.
In PowerShell, the bash script would never be picked byruby ....
So we need a reliable way to haveruby ...work in PowerShell for JRuby in Windows CIs.The Bash script should also work with Bash on Windows, but currently it doesn't deal with quotes correctly.
My current workaround is copying the jruby Bash script to ruby, and adding ruby.bat but it's not perfect and it feels hacky I have to mess with the launchers manually:
https://github.com/ruby/ruby-builder/blob/b4e83abd2f97c1374f0e54cde134b359947df550/.github/workflows/build.yml#L108-L111Could we maybe fix whatever in jruby.exe assumes the executable to be named
jruby.exe? Then at least we could copy it toruby.exeand that would hopefully work.
Even better would be to provideruby.exeout of the box.A trivial fix would be to have the launcher build and install both
jruby.exeandruby.exe.Someone's going to have to get the launcher updated to support our
.java_optsfiles very soon so this should get fixed at the same time.Reacted by Benoit DalozeAnother reason is the latest jruby snapshot currently generates this for
bundle.bataftergem install bundler:@ECHO OFF @"%~dp0ruby.exe" "%~dpn0" %*Which is
ruby.exe, notjruby.exe, sobundleprobably doesn't work at all on Windows with the latest jruby snapshot:
https://oss.sonatype.org/content/repositories/snapshots/org/jruby/jruby-dist/9.2.10.0-SNAPSHOT/jruby-dist-9.2.10.0-20200214.210645-79-bin.tar.gzWe do not generate those stubs... it's almost certainly something that has changed in RubyGems.
This is rubygems issue ruby/rubygems#2873 (a 3.0 specific regression caused by ruby/rubygems#2119). It was fixed by ruby/rubygems#2876, which is present in the latest rubygems but it was never backported to rubygems 3.0 (although it's been scheduled for backport to rubygems 3.0.7).
@hsbt Do you still intend to release rubygems 3.0.7 including ruby/rubygems#2876?
Reacted by Benoit DalozeIf we can get RubyGems 3.0.7 I can update it for JRuby 9.2.10, due out VERY SOON.
@hsbt Do you still intend to release rubygems 3.0.7 including rubygems/rubygems#2876?
I will release RG 3.0.7 in this week.
- Reacted by David Rodríguez
Thanks for releasing so quickly @hsbt!
Unfortunately there's a regression in 3.0.7, could you have a look at ruby/rubygems#3139?
6 remaining items
BTW there is also https://github.com/ruby/jruby-dev-builder/blob/841382ecf34207d4dbf921557e4c8fc2fa02f28f/.github/workflows/build.yml#L118-L122 on non-Windows and basically all Ruby installers need to work around that by symlinking manually, it'd be best to not need that.
The issue is that repo still needs to workaround
So adding that same ruby.bat to our distribution would be enough for now?
basically all Ruby installers need to work around that by symlinking manually
JRuby already links
bin/rubytobin/jruby. Is that not sufficient?It may be better in the long run to just ship the shell script as both
bin/jrubyandbin/rubyand the native executable as bothjruby.exeandruby.exe.- added a commit that references this issue
on Jun 25, 2025 So adding that same ruby.bat to our distribution would be enough for now?
Doing the same commands but before creating the JRuby archive should work, yes.
I'm not sure it's the best solution, it's just a solution I found that works in GitHub Actions.JRuby already links
bin/rubytobin/jruby. Is that not sufficient?It doesn't: https://github.com/ruby/jruby-dev-builder/actions/runs/15450501641/job/43491183427#step:8:48
Looking at https://github.com/jruby/jruby/releases/download/10.0.0.1/jruby-bin-10.0.0.1.tar.gz there is nobin/rubyeither.It may be better in the long run to just ship the shell script as both
bin/jrubyandbin/rubyand the native executable as bothjruby.exeandruby.exe.Yes, that sounds like a proper solution that would work for a single archive for POSIX & Windows.
Though there was an issue with just copying the.exeand it errored IIRC but that should be easy to test if still a problem.I have opened jruby/jruby#8875 to copy
bin/jruby.shto bothbin/jrubyandbin/ruby, and also include the known-workingbin/ruby.batin our distributions.Looking at https://github.com/jruby/jruby/releases/download/10.0.0.1/jruby-bin-10.0.0.1.tar.gz there is no bin/ruby either.
The tarball build must not be including the symlink. It was intended to. The PR eliminates the symlink and makes it another copy of the shell script.
Reacted by Benoit DalozeIt doesn't
It does: https://github.com/jruby/jruby/blob/master/bin/ruby
Seems like it's a build problem or an issue generating the tarball.
- added 2 commits that reference this issue
on Jul 9, 2025 This should be fixed by #54.
Correction:
- Also copy binary to bin/ruby #54 will install a native executable for
bin/rubywhen installed on unix, addressing part of the concerns. - Pregenerate bin/ruby and bin/ruby.bat jruby#8875 should fix the remaining issues by shipping a
bin/ruby.batlike the stub that installers have been creating, as well as abin/rubyfor unix that just launchesbin/jruby.sh.
- Also copy binary to bin/ruby #54 will install a native executable for
See jruby/jruby#6042 (comment)
Currently it's not obvious how to make
ruby ...work on Windows.On Unix this is usually done easily with
ln -s jruby ruby, but on Windows the only way I could find is to create aruby.batwith:(I also tried
mklinkon Windows, that doesn't work)It would be nice if this could be simplified and e.g. JRuby already ships with that
ruby.batandrubyfiles.gem,rake, etc already conflict with MRI binaries so the only way to use a Ruby is to add it to PATH anyway. Not having something forruby ...means there is a the danger to use MRI for that one, but not for other commands such asgemandrake, which is never intended.