Ruby-build: 1.9.3 fails to use libyaml or zlib, unable to install bundler

Created on 22 Oct 2020  Â·  12Comments  Â·  Source: rbenv/ruby-build

brew --prefix zlib
brew --prefix [email protected]
brew --prefix libyaml

/usr/local/Cellar/zlib/1.2.11
/usr/local/opt/[email protected]
/usr/local/opt/libyaml

➜  fpr git:(master) ✗                                                                                       
rbenv uninstall -f 1.9.3-p551
RUBY_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-openssl-dir=$(brew --prefix [email protected]) --with-libyaml-dir=$(brew --prefix libyaml)" rbenv install 1.9.3-p551

Downloading ruby-1.9.3-p551.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.bz2
Installing ruby-1.9.3-p551...

WARNING: ruby-1.9.3-p551 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew
Installed ruby-1.9.3-p551 to /Users/jemminger/.rbenv/versions/1.9.3-p551

➜  fpr git:(master) ✗ gem install bundler -v'~>1.17.0'
/Users/jemminger/.rbenv/versions/1.9.3-p551/lib/ruby/1.9.1/yaml.rb:84:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR:  Loading command: install (LoadError)
    cannot load such file -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

Most helpful comment

MacOS Catalina here.

All 12 comments

Exactly same issue here.

Also experiencing this issue on a very old project..

I'm having the same issue as user above me.

I am also having this issue

Same issue as well.

Are you using OpenSSL 1.1 or 1.0? See https://github.com/rbenv/ruby-build/wiki#openssl-version-compatibility

Just tried with OpenSSL 1.0...

$ RUBY_CONFIGURE_OPTS="--with-zlib-dir=$(brew --prefix zlib) --with-libyaml-dir=$(brew --prefix libyaml) --with-openssl-dir=$(brew --prefix [email protected])" rbenv install 1.9.3-p551

Same described issue.

FWIW, I reinstalled everything ~3 weeks ago, and rbenv install 1.9.3-p551 (no other config flag) worked without an issue (OS X Mojave)

MacOS Catalina here.

I'm receiving the same error, I tried even compiling manually and the behavior is the same

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" ruby-build 1.9.3-p551 ~/.rubies/ruby-1.9.3
ruby-build: using libyaml from homebrew
Downloading ruby-1.9.3-p551.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.bz2
Installing ruby-1.9.3-p551...

WARNING: ruby-1.9.3-p551 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew
Installed ruby-1.9.3-p551 to /Users/xavi/.rubies/ruby-1.9.3

Then:

/Users/xavi/.rubies/ruby-1.9.3/lib/ruby/1.9.1/yaml.rb:84:in ` It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand

The fix is to set CFLAGS, which was changed in xcode 12: https://github.com/rbenv/ruby-build/issues/1489

export CFLAGS="-Wno-error=implicit-function-declaration"

This was all I had to do. This solved my compilation problems with the downloaded/embedded openssl that ruby-build installs as well as the problems compiling ruby itself.

Try with https://github.com/rbenv/ruby-build/issues/1485#issuecomment-814180122 . I could install Ruby 1.9.3 with macOS Big Sur and Xcode 12.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artoodeeto picture artoodeeto  Â·  4Comments

k0kubun picture k0kubun  Â·  3Comments

snibbets picture snibbets  Â·  3Comments

florentmorin picture florentmorin  Â·  5Comments

eddroid picture eddroid  Â·  4Comments