Gemset error when updating to Ruby 2.4.2

2.4k Views Asked by At

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/[email protected]

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

There are 3 best solutions below

1
AudioBubble On BEST ANSWER

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       
8
David Watson On

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

0
Chris Rymer On

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