Friday, 24 July 2015

"rvm install jruby-" insists on installing pre1, rc1 or rc2

So... Yeah...

Been eagerly awaiting jruby-9000. And used rvm to install the pre1, rc1 and rc2 versions for testing against micro-services.

Then crashed right into a problem when the final release came out.

I tried to "rvm install jruby-" and it said there was already a cached version "ruby-".

Ok I thought, so I did "rvm list" and uninstalled all the previous jrubies.

Then removed any reference to jruby from "~/.rvm/archives".

Then "rvm get stable".

Then "rvm install jruby-" again.

To my chagrin, it did this:

Searching for binary rubies, this might take some time.
Found remote file
...compilation elided...

Guessing that there may actually be a release version on s3, I wget'd ""

Luckily that worked and I copied the file to "~/.rvm/archives".

I uninstalled and removed the other "pre1" version and tried again.

But no.
Despite having jruby-bin- in the archives folder, rvm insists on downloading the pre1 version.

Then the "Ahaha!"

After mucking about with rvm --debug and --trace commands I found this wonderful thing in the output (which was frickin ginormous):

+ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  12 > [[ -z jruby-9\.0\.0\.0.* ]]

#Ed: This looks interesting...
++ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  -221 > command cat /Users/kimberleyscott/.rvm/config/known_strings

++ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  -219 > __rvm_version_sort
++ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  -218 > __rvm_tail -n 1

#Ed: Notice the regex
++ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  -220 > __rvm_grep 'jruby-9\.0\.0\.0.*'

++ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  -463 > cat /Users/kimberleyscott/.rvm/config/known_strings
++ 1437712726.N /scripts/functions/support : __rvm_tail()  0 > tail -n 1
++ 1437712726.N /scripts/functions/utility : __rvm_version_sort()  1 > LC_ALL=C
++ 1437712726.N /scripts/functions/support : __rvm_grep()  0 > GREP_OPTIONS=
++ 1437712726.N /scripts/functions/utility : __rvm_version_sort()  1 > command sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
++ 1437712726.N /scripts/functions/support : __rvm_grep()  0 > command grep 'jruby-9\.0\.0\.0.*'
++ 1437712726.N /scripts/functions/utility : __rvm_version_sort()  -167 > sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n
++ 1437712726.N /scripts/functions/support : __rvm_grep()  -260 > grep 'jruby-9\.0\.0\.0.*'

# Ed: and here is the result:
+ 1437712726.N /scripts/functions/selector_parse : __rvm_ruby_string_latest()  20 > new_ruby_string=jruby-

Well... "~/.rvm/config/known_strings" looks like an interesting file doesn't it?

And lo and behold, I can now see how the rvm script decided on pre1.
so I changed this:

# this strings are matched only when partial version was provided

to this:

# this strings are matched only when partial version was provided
#jruby- - commented for safety

And did a fresh "rvm --debug install jruby-".
Loads of green and purple output.
But wayhey! Installed.

rum now shows it installed:

rvm rubies

 * jruby-1.7.19 [ x86_64 ]
   jruby-1.7.20 [ x86_64 ]
   jruby-1.7.21 [ x86_64 ]
=> jruby- [ x86_64 ]
   ruby-2.2.0 [ x86_64 ]
   ruby-2.2.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Hope this helps others!


  1. Thank you for this post! I was having the same problem and it was driving me nuts.