0

I'm updating from Ruby 2.0 to 2.4.2 using RVM, and receive the following error messages during an install using $ rvm install ruby-2.4.2:

Making gemset ruby-2.4.2 pristine - please wait

'command gem pristine --extensions bigdecimal --version 1.3.0 gem-wrappers --version 1.3.2 io-console --version 0.4.6 json --version 2.0.4 openssl --version 2.0.5 psych --version 2.2.2' failed, you need to fix this gems manually.
Error running '__rvm_with ruby-2.4.2 gemset_pristine',
please read /Users/myname/.rvm/log/1507820191_ruby-2.4.2/gemset.pristine-ruby-2.4.2.log

Making gemset ruby-2.4.2@global pristine - please wait

'command gem pristine --extensions bigdecimal --version 1.3.0 io-console --version 0.4.6 json --version 2.0.4 openssl --version 2.0.5 psych --version 2.2.2' failed, you need to fix this gems manually.
Error running '__rvm_with ruby-2.4.2@global gemset_pristine',
please read /Users/myname/.rvm/log/1507820191_ruby-2.4.2/gemset.pristine-ruby-2.4.2@global.log

I'm… not quite sure what this means, or what I should do next. Any thoughts? I'm running macOS 10.12.6.

[Edit]: Here's a copy of the error log.

3 Answers3

0

According to the RVM docs, you don't use ruby- in the command.
It should be: $ rvm install 2.4.2
I'm not sure if that matters or not though. Have you tried upgrading RVM and Homebrew?

[Edit] Based on this info from the log file:

bigdecimal-1.3.0 +gemset_pristine:20> gem pristine --extensions bigdecimal --version 1.3.0
ERROR:  Loading command: pristine (LoadError)
    cannot load such file -- zlib
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
+gemset_pristine:21> _failed+=( 'bigdecimal --version 1.3.0' )  

Looks like a zlib problem. Try installing (or re-installing) Command Line Tools.
$ xcode-select --install

There is a very similar issue on github https://github.com/rvm/rvm/issues/4090 It was solved by running $ brew doctor

David Watson
  • 195
  • 6
  • I get the same result running `$ rvm install 2.4.2` so it doesn't matter. Also, running latest versions of RVM [1.29.3] and Homebrew [1.3.5] –  Oct 12 '17 at 19:37
  • I can't test since I'm still on 10.11.6 Have you looked at the log file referenced in the error? – David Watson Oct 12 '17 at 19:42
  • I did, but the error log didn't seem to contain any useful information that the terminal output didn't. But I might as well be looking at hieroglyphics. Here it is: https://gist.github.com/gwijthoff/8a3e485537787604ac8d1bd4991ea889 –  Oct 13 '17 at 11:51
  • I edited my answer. Looks like a zlib problem. (or possibly SSL related) – David Watson Oct 13 '17 at 14:38
  • Very strange. Reinstalled command line tools and zlib.h is where it's supposed to be in `/usr/include/`. Maybe it's an issue with where RVM expects zlib to be? The problem seems to be confined to that one gem command, `pristine`. I think I'll post this as an issue on the RVM github. Thanks for your help, this is super frustrating. –  Oct 13 '17 at 15:18
  • If you get an answer, please post it here. I'm really curious. Somehow I don't think it's an RVM problem. – David Watson Oct 13 '17 at 16:58
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/156687/discussion-between-david-watson-and-strobodyne). – David Watson Oct 13 '17 at 17:15
  • I have just run the same `rvm reinstall 2.x.y` __twice__ :-) First, it failed with the error message above, then it succeeded... – karatedog Sep 07 '20 at 14:12
0

Found a fix as referenced in this RVM GitHub issue that involves installing zlib using brew and then re-installing ruby while pointing to that zlib directory. As someone in that thread pointed out, this shouldn't be necessary. Still not sure why the problem arose.

Steps

$ brew install zlib
$ rvm remove 2.4.2
$ rvm install 2.4.2 —-with-zlib-dir=/usr/local/Cellar/zlib/1.2.11       
lakshman sai
  • 481
  • 6
  • 14
  • I am sorry if a comment isn't the right way but I was not allowed to suggest edit. It looks some autoformat or similar thing happened to this block. the right option is with -- so `rvm install 2.4.2 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11` – RailTracer Sep 10 '20 at 15:31
0

Just came up against this after needing to use SASS after a while. During which time I had upgraded to El Capitan. So Ruby was 'Old'.

You could probably cut a lot of my steps out by running the following (with a little prior knowledge of the latest Ruby Version).

xcode-select --install brew install zlib rvm reinstall ruby-<latest_version> --with-zlib-dir=/usr/local/Cellar/zlib/<latest_version>


This was how I had to go about it. I didn't need to uninstall in the end but I took a lot of wrong turns.

Initially I had to run this line to get xcode up to date:

xcode-select --install

Then install zlib

brew install zlib

Take a note of the directory zlib is installed in

/usr/local/Cellar/zlib/1.2.11

Next update rvm

\curl -sSL https://get.rvm.io | bash -s stable --ruby

Following these steps got me to the point where I was running the latest version of ruby 2.4.1. But zlib wasn't linked to ruby.

So the final step was to run a reinstall

rvm reinstall ruby-2.4.1 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11

Chris Rymer
  • 713
  • 5
  • 16