RBENV: Working tree error when rbenv install some ruby versions on macOS Catalina.

Sasikate Suwanchatree
4 min readApr 6, 2020

After I fixed RBENV: Cannot install some ruby versions - Error: unknown type name ‘lzma_bool’.

(some versions: 2.6.0, 2.6.5, 2.7.0)

but I found another Error!

Inspect or clean up the working tree at /var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo
Results logged to /var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.log
Last 10 log lines:
from /private/var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo/ruby-2.6.0/lib/rubygems/specification.rb:768:in `block (2 levels) in each_gemspec'
from /private/var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo/ruby-2.6.0/lib/rubygems/specification.rb:767:in `each'
from /private/var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo/ruby-2.6.0/lib/rubygems/specification.rb:767:in `block in each_gemspec'
from /private/var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo/ruby-2.6.0/lib/rubygems/specification.rb:766:in `each'
from /private/var/folders/56/mdm3gprs5xz9hw2l7sbnsfd00000gn/T/ruby-build.20200406201822.35049.qlQzeo/ruby-2.6.0/lib/rubygems/specification.rb:766:in `each_gemspec'
from ./tool/rbinstall.rb:809:in `block in <main>'
from ./tool/rbinstall.rb:876:in `block in <main>'
from ./tool/rbinstall.rb:873:in `each'
from ./tool/rbinstall.rb:873:in `<main>'
make: *** [do-install-all] Error 1

What the hell happened on this laptop?

So I asked my friend who is a RUBY expert but he didn’t find the quick solution so …

Let’s guess! 😛

🙈You can skip all clues below to the final solution in the end 🎉 (I just want to note +3hrs. , I have been searching for the solution)

  • 1st clue: I have been successfully installed $ rbenv install 2.x.x on the other laptop so I guess something must be missed on this laptop!
  • 2nd clue: I just updated this macOS to Catalina v. 10.15.4 (March 2020)
  • 3rd clue: So I searched on Google “rbenv version 2.6.5' is not installed Catalina”. I found this article and I spotted the comment that mentioned Xcode.

Hmm, I’m not sure we need Xcode for Ruby. But I have no idea now so JUST DO IT with high hopes of fixing this!

Not working!

  • Then no more clue:
    Ok. I back to the basic step-by-step below which leads to the solution.
# Upgrade rbenv,ruby build again
$ brew upgrade rbenv ruby-build
# Check Gem Version
$ gem --version

… I found some errors on the RubyGems plugin: “ openssl.bundle ”.

🙈 Then I realized I already have RVM on my old laptop!

Before I replace RVM with RBENV,

I found this article: Error loading RubyGems plugin ,openssl.bundle (LoadError) So I tried with the top comment by using the most rvm stable version and check the gem version again.

$ rvm get stable
$ gem --version

☑️ The error is gone, then
$ brew reinstall rbenv → working

Still, not working on $ rbenv install 2.x.x

🌱 The 1st solution to keep RVM and RBENV 🎉

( or check the 2nd solution to Replace RVM with RBENV )

Like this guy, he asked on StackOverflow: rvm and rbenv on the same machine?

☑️ 1. Try the below commands, and it will make more progress, with the new error 😍.

$ brew reinstall openssl
$ brew upgrade ruby-build rbenv
$ rvm reinstall ruby

The new error …

No binary rubies available for: osx/10.15/x86_64/ruby-2.7.0.Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.....Installing required packages: automake, libtool, libyaml, libksba - please waitThere were package installation errors, make sure to read the log.Try `brew tap --repair` and make sure `brew doctor` looks reasonable.Check Homebrew requirements https://docs.brew.sh/InstallationError running 'requirements_osx_brew_libs_install automake libtool libyaml libksba',please read /Users/palm/.rvm/log/1586200187_ruby-2.7.0/package_install_automake_libtool_libyaml_libksba.logRequirements installation failed with status: 1.

( ❌ brew tap — repair → not work for me)

☑️ 2. To make sure, upgrade these dependencies manually 1 by 1.

$ brew upgrade automake 
$ brew upgrade
libtool
$ brew upgrade
libyaml
$ brew upgrade
libksba

☑️ 3. Reinstall ruby by rvm again. No error.😍

$ rvm reinstall ruby
# check ruby version to make sure
$ ruby -v

☑️ 4. Install ruby by rbenv again. No error.😍

$ rbenv install 2.6.5
# check ruby version is on rbenv with rbenv-doctor
$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

🎉🎉🎉

🌱 The 2nd solution to Replace RVM wih RBENV 🎉

☑️ Just follow these simple steps: https://gist.github.com/akdetrick/7604130.

➕ More interesting story of RVM and RBENV here:
Why and How I Replaced RVM with RBENV

The solutions are all simple but you might struggle for many hours if you don’t know the core cause of the issue.

Hope it is useful for you!💕

--

--