Title says it all... I get a missing dependency error for libyaml (required to build the psych gem) even though libyaml is correctly installed:
$ brew install libyaml
Warning: libyaml 0.2.5 is already installed and up-to-date
To reinstall 0.2.5, run `brew reinstall libyaml`
$ brew reinstall libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.2.5.catalina.bott
######################################################################## 100.0%
==> Reinstalling libyaml
==> Pouring libyaml-0.2.5.catalina.bottle.tar.gz
馃嵑 /usr/local/Cellar/libyaml/0.2.5: 10 files, 323.5KB
$ brew cleanup
$ rbenv install 2.7.2
Downloading openssl-1.1.1g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/stevewi/.rbenv/versions/2.7.2
Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201011092736.97275.wciA9q
Results logged to /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201011092736.97275.log
Last 10 log lines:
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/stevewi/.rbenv/versions/2.7.2
--with-openssl-dir=/Users/stevewi/.rbenv/versions/2.7.2/openssl
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/stevewi/.rbenv/versions/2.7.2/lib
CPPFLAGS=-I/Users/stevewi/.rbenv/versions/2.7.2/include
I filed this same defect on rbenv/rbenv...which was probably the wrong place... I couldn't figure out how to move it here so the one on rbenv/rbenv. should probably be closed in favor of this one.
Can you try it without homebrew?
How?
I've tried setting --with-opts-dir and setting LDFLAGS/CPPFLAGS/LIBS. None of those worked either. AFAIK, there is no --with-yaml-dir similar to with-openssl-dir.
stevewi:~ $ brew upgrade
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
device-mapper gcalcli or-tools
==> Updated Formulae
Updated 45 formulae.
==> Deleted Formulae
meson-internal
==> Updated Casks
<irrelevant info redacted>
stevewi:~ $ brew reinstall libyaml
==> Downloading https://homebrew.bintray.com/bottles/libyaml-0.2.5.catalina.bott
######################################################################## 100.0%
==> Reinstalling libyaml
==> Pouring libyaml-0.2.5.catalina.bottle.tar.gz
馃嵑 /usr/local/Cellar/libyaml/0.2.5: 10 files, 323.5KB
stevewi:~ $ rbenv install 2.7.2
Downloading openssl-1.1.1g.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/stevewi/.rbenv/versions/2.7.2
Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201019060150.23051.8zFr0J
Results logged to /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201019060150.23051.log
Last 10 log lines:
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/stevewi/.rbenv/versions/2.7.2
--with-openssl-dir=/Users/stevewi/.rbenv/versions/2.7.2/openssl
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/stevewi/.rbenv/versions/2.7.2/lib
CPPFLAGS=-I/Users/stevewi/.rbenv/versions/2.7.2/include
Here's an example with LDFLAGS/LIBS/CPPFLAGS set:
stevewi:~ $ ll /usr/local/opt/libyaml/include
total 112
-rw-r--r-- 1 stevewi staff 54439 Jun 1 14:19 yaml.h
stevewi:~ $ ll /usr/local/opt/libyaml/lib
total 520
-r--r--r-- 1 stevewi staff 118872 Oct 19 06:13 libyaml-0.2.dylib
-r--r--r-- 1 stevewi staff 142496 Jun 1 14:19 libyaml.a
lrwxr-xr-x 1 stevewi staff 17 Jun 1 14:19 libyaml.dylib -> libyaml-0.2.dylib
drwxr-xr-x 3 stevewi staff 96 Oct 19 06:13 pkgconfig
stevewi:/usr/local/opt/libyaml/lib $ cd
stevewi:~ $ export LDFLAGS=-L/usr/local/opt/libyaml/lib
stevewi:~ $ export LIBS="-l yaml"
stevewi:~ $ export CPPFLAGS=-I/usr/local/opt/libyaml/include
stevewi:~ $ rbenv install 2.7.2
Installing openssl-1.1.1g...
Installed openssl-1.1.1g to /Users/stevewi/.rbenv/versions/2.7.2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201019064956.95483.Siqe4a
Results logged to /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201019064956.95483.log
Last 10 log lines:
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/stevewi/.rbenv/versions/2.7.2
--with-openssl-dir=/Users/stevewi/.rbenv/versions/2.7.2/openssl
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/stevewi/.rbenv/versions/2.7.2/lib -L/usr/local/opt/libyaml/lib
LIBS=-l yaml
CPPFLAGS=-I/Users/stevewi/.rbenv/versions/2.7.2/include -I/usr/local/opt/libyaml/include
I have the same issue on the same OS. Do you have this in the log?
Apple clang version 12.0.0 (clang-1200.0.32.21)
Target: x86_64-apple-darwin19.6.0
I suspect a new version of Clang (Xcode 12) is the cause. It seems OpenSSL isn't compiling correctly with it.
Here's my clang version:
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I copied ruby-2.7.2.tar.bz2 from $HOME/.rbenv/cache to $HOME; extracted it; and configured it manually:
./configure --prefix=$HOME/.rbenv/versions/2.7.2 \
--with-openssl-dir=/usr/local/opt/[email protected] \
--enable-shared \
--with-readline-dir=/usr/local/opt/readline
I ran make with _SUCCESS_.
I ran make install with _SUCCESS_.
I updated $HOME/.rbenv/.version to 2.7.2 with rbenv global 2.7.2.
I updated $HOME/.ruby-version to 2.7.2 with vi.
All seems to be working well:
$ ruby --version
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
P.S. I also had to remove $HOME/.gems & $HOME/.gem and re-install local gems (e.g., byebug, nokogiri, nokogumbo).
P.P.S. I also had to rebuild all my local projects that used bundler (I only had one).
Nice! Clang 12 was the only thing consistent among my two machines aside from ruby-build and both machines in the past have built Ruby so it was a working theory. This appears to confirm it is ruby-build.
I just tried to re-install 2.7.1 with rbenv:
rbenv install 2.7.1
to test out my default settings:
export RUBY_CONFIGURE_OPTS=--with-openssl-dir=/usr/local/opt/[email protected] --with-readline-dir=/usr/local/opt/readline
and the install failed in the same manner as in my OP with the same error. This previously worked (although _not_ with the current version of ruby-build -- 20201005). I got the exact same failure with 3.0.0-preview1 too.
The workaround I described above worked for both of these. I used the same version of clang as I reported previously.
Another datapoint: I had the same problem except I'm using asdf to manage ruby versions. (asdf seems to use rbenv under the hood anyway.)
I tried RUBY_CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/[email protected] --with-libyaml-dir=/usr/local/opt/libyaml" asdf install ruby 2.7.2 which failed
Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/r6/35d6jll131j9s3q4yzvgxqqc0000gn/T/ruby-build.20201106122657.49603.Od1EaH
Results logged to /var/folders/r6/35d6jll131j9s3q4yzvgxqqc0000gn/T/ruby-build.20201106122657.49603.log
Last 10 log lines:
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/sebastiangeiger/.asdf/installs/ruby/2.7.2
--with-openssl-dir=/usr/local/opt/[email protected]
--with-libyaml-dir=/usr/local/opt/libyaml
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/sebastiangeiger/.asdf/installs/ruby/2.7.2/lib
CPPFLAGS=-I/Users/sebastiangeiger/.asdf/installs/ruby/2.7.2/include
I then went into the folder that it told me in Inspect or clean up the working tree at /var/folders/r6/35d6jll131j9s3q4yzvgxqqc0000gn/T/ruby-build.20201106122657.49603.Od1EaH
In the folder I did:
$ ./configure --prefix=$HOME/.asdf/installs/ruby/2.7.2 \
--with-openssl-dir=/usr/local/opt/[email protected] \
--enable-shared \
--with-readline-dir=/usr/local/opt/readline
followed by
make && make install
Additionally I had to do the following to get my project to build again
asdf reshim ruby 2.7.2
rm -rf ~/.gem
rm -rf ~/.gems
gem install bundler
bundle install
$ ~/.asdf/plugins/ruby/ruby-build/bin/ruby-build --version
ruby-build 20201005
This report sounds suspiciously the same as well.
I have the same error.
Interesting that 2.7.1 installs perfectly, but 2.7.2 fails with the psych/libyaml error, as reported above. Nothing too useful in the logs.
macOS 11.0.1, latest homebrew with latest libyaml. Had the same issue on macOS 10.15. I also happen to have a brew unlinked Ruby version 2.7.2 as a dependency of the vim formula. How to reproduce: latest macOS, Homebrew, rbenv and ruby-build from HEAD. brew update && brew install vim rbenv; rbenv install 2.7.1 (works); rbenv install 2.7.2 (fails).
I am getting the same result with and without RUBY_CONFIGURE_OPTS set with --with-openssl-dir to [email protected].
@yaroslav
I get the same issue as in the OP with 2.7.1 as well:
stevewi:~ $ rbenv install 2.7.1
Downloading ruby-2.7.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.1.tar.bz2
Installing ruby-2.7.1...
BUILD FAILED (Mac OS X 10.15.7 using ruby-build 20201005)
Inspect or clean up the working tree at /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201115180406.95168.f17gor
Results logged to /var/folders/pj/qdpn6dzn7ds24bpb6x0jmtcc0000gn/T/ruby-build.20201115180406.95168.log
Last 10 log lines:
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/stevewi/.rbenv/versions/2.7.1
--with-openssl-dir=/usr/local/opt/[email protected]
--with-readline-dir=/usr/local/opt/readline
--enable-shared
CC=clang
LDFLAGS=-L/Users/stevewi/.rbenv/versions/2.7.1/lib
CPPFLAGS=-I/Users/stevewi/.rbenv/versions/2.7.1/include
Does it resolve if you try 'rm -rf ~/.gem'? It was a step I took while trying to diagnose it. I can compile 2.7.2 now without issue but unsure which step resolved it.
Removing _.gem_:
rm -rf ~/.gem
allowed 2.7.2 to install successfully but I got the same error as before with 2.7.1.
What about nuking the gem folder before each install?
Nuking ~/.gem before rbenv install indeed solved it. Not sure if it is a tidy or proper way, or should be recommended at all, though.
@yaroslav writes:
Nuking ~/.gem before rbenv install indeed solved it. Not sure if it is a tidy or proper way, or should be recommended at all, though.
Since it's not reliable (see below); it doesn't really matter "if it is a tidy or proper way, or should be recommended at all, though." The only reliable way I've found to make this work is to extract it and configure/build it manually (as noted above).
@thewalkingtoast writes:
What about nuking the gem folder before each install?
Among recent ruby's, 2.7.2 appears to be an anomaly. Here's the results of my experiments:
rm -rf ~/.gem; rbenv install 2.7.0 -- failed
rm -rf ~/.gem; rbenv install 2.7.1 -- failed
rm -rf ~/.gem; rbenv install 2.7.2 -- succeeded
rm -rf ~/.gem; rbenv install 3.0.0-preview1 -- failed
IMHO, this kind of defeats the purpose of _rbenv_. It's looking more and more like all this activity is going nowhere... Have any of the developers responded?
A new version of ruby-build dropped today..._20201117_. Here's the results of the previous experiment with the new version:
rm -rf ~/.gem; rbenv install 2.7.0 -- failed
rm -rf ~/.gem; rbenv install 2.7.1 -- failed
rm -rf ~/.gem; rbenv install 2.7.2 -- succeeded
rm -rf ~/.gem; rbenv install 3.0.0-preview1 -- failed
The nature of the failure is the same as described in the OP.
A new version of ruby-build dropped today..._20201118_:
==> Summary
馃嵑 /usr/local/Cellar/ruby-build/20201118: 513 files, 255.7KB, built in 4 seconds
Removing: /usr/local/Cellar/ruby-build/20201117... (512 files, 255KB)
Removing: /Users/stevewi/Library/Caches/Homebrew/ruby-build--20201117.tar.gz... (67.6KB)
Here's the results of the previous experiment with the new version:
rm -rf ~/.gem; rbenv install 2.7.0 -- failed
rm -rf ~/.gem; rbenv install 2.7.1 -- failed
rm -rf ~/.gem; rbenv install 2.7.2 -- succeeded
rm -rf ~/.gem; rbenv install 3.0.0-preview1 -- failed
The nature of the failure is the same as described in the OP.
Well, I guess it's time to chuck this POS and find something else.
Idk how this will work on Big Sur and at this point I'm too afraid to ask.
This has been broken for so long, I've almost forgotten that it ever worked correctly. Zero response from the developers.
Because I never reproduce it.
Close it then...I've switched to 'rvm'.
Man... I switch to rbenv from rvm because I couldn't install old rubies on new Mac OS versions due to open ssl issues. If there are requirements missing in order to build older rubies, shouldn't ruby-build supply them as part of the compilation process instead of relying on Mac OS/Xcode to supply them?
I'd hardly consider 2.7.0 & 2.7.1 to be "old rubies"...3.0.0-preview1 is newer than currently-released. Also, installing them with my rbenv setup worked at one time...and I got it to work by manually configuring it and installing it -- just _not_ using rbenv install .... See my post above.
I use(d) rbenv to be able to use a ruby that's newer than the macOS-supplied version (which is 2.6.3). That means I don't really do serious development with it -- I have an Odroid HC1 with an SSD running _armbian 10--Buster_ (which also stages for a _Debian 10_ VPS) for that.
The developer says he couldn't reproduce my issue...although several others have. We've all done as much as we can do until the developer decides the issue has a higher priority for him.
FWIW, you can solve your rvm openssl dependencies using reply #16 found here. I can't vouch for the solution's efficacy though...
sebastiangeiger
Your instructions were the only thing that worked for me. Also worked for 2.6.6. Thanks!
Most helpful comment
Removing _.gem_:
allowed 2.7.2 to install successfully but I got the same error as before with 2.7.1.