ruby-build: Unable to install Ruby 2.5.1 on macOS 10.14 Mojave
When running the following:
rbenv install 2.5.1
The install fails with the following output:
ruby-build: use openssl from homebrew
Downloading ruby-2.5.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2
Installing ruby-2.5.1...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.14 using ruby-build 20180822)
Inspect or clean up the working tree at /var/folders/5g/f1t038j95cnf6xcvb783rl5hh80m9n/T/ruby-build.20180925130957.80594
Results logged to /var/folders/5g/f1t038j95cnf6xcvb783rl5hh80m9n/T/ruby-build.20180925130957.80594.log
Last 10 log lines:
Ignoring openssl-2.1.1 because its extensions are not built. Try: gem pristine openssl --version 2.1.1
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/mthompson/.local/share/rbenv/versions/2.5.1
--with-openssl-dir=/usr/local/opt/openssl
--with-readline-dir=/usr/local/opt/readline
CC=clang
CFLAGS= -O3 -Wno-error=shorten-64-to-32
LDFLAGS=-L/Users/mthompson/.local/share/rbenv/versions/2.5.1/lib
CPPFLAGS=-I/Users/mthompson/.local/share/rbenv/versions/2.5.1/include
Full log: https://gist.github.com/ActionScripted/526c7a85797fb0d05bb54000bc922d00
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 35 (3 by maintainers)
@VivaLosDoyers thanks for the suggestion! I changed the developer directory from
/Applications/Xcode.app/Contents/Developerto/Library/Developer/CommandLineToolsand unfortunately it still isn’t working (same error/output as above).Here’s what I tried:
Just do
sudo rvm install 2.5.1Found a fix, at least for me. I did a lot all at once and now things are working but I cannot discern which changes specifically fixed things. I believe this was an issue with some stale ruby/gem folders in
/usr/local,~/.local/share/rbenv,~/.local/share/gem. (Note that my rbenv and gem paths are different because I prefer XDG Base Directory locations and I’m overriding things using environment variables.)I removed the following:
Then installed rbenv and tested:
And it works like a charm. The only thing that seems weird to me is that when I use Ruby 2.5.1 via
rbenv global 2.5.1my gem paths include references to 2.5.0:Does it matter that the gem environment specifies paths to 2.5.0 while the Ruby version is 2.5.1? Everything seems to be working without issue, so maybe that’s not a problem?
At any rate, error on my end from having stale files/folders laying around after upgrading. Just needed to remove everything and start fresh and things work as expected.
After upgrading to 10.14, I encountered the similar error. Follow the comments below, I deleted ( = mv)
/usr/local/includefolder. And I succeeded in installing rbenv (likerbenv install 2.5.1).https://github.com/rbenv/rbenv/issues/1059#issuecomment-420460206
Thanks @franklouwers you pointed in me in the right direction (what a nightmare!)
I followed this post which linked to these release notes which reference instructions about how command line tools now behave with respect to headers. It also provides a backup package (located at
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg) which can be installed to also get headers into/usr/includefor software that doesn’t yet support using the Xcode SDK.Digging around a bit, looks like there’s an issue building Ruby using RVM also: https://github.com/rvm/rvm/issues/4453
Might not be related, but there’s some great output there that might help. I’m thinking this is less rbenv/RVM and more something with building Ruby on 10.14. But I don’t know much about the internals of building Ruby.
Mislav, just to clarify (for other people that would end up at this page after a frustrating search-engine trip through the rabbit-hole): I did not have MacPorts installed, at any time the last 7 years on any of my macs. So the issue can pop up without having MacPorts installed as well! The key would be to check if you have a /usr/include directory. If you have, you have this issue 😃
Thank you so much!! It worked for me. Thanks for ending this Terminal nightmare.
i followed this approach (using
mvto be safe) and i was able to reinstall2.3.1and2.4.2. 👍With a clean brew, running
brew install rbenvbrings along: autoconf, openssl, pkg-config, ruby-build.I removed everything from brew, ran
brew install rbenvand then triedrbenv install 2.5.1with the same result as before. Also triedrbenv initin a fresh folder and then the install with the same result.I also tried both installs using the env vars from the brew openssl install output:
FWIW I was able to install on a fresh Mojave installation on a 2012 MacBook Pro:
brew install rbenvrbenv install 2.5.1It’s worth mentioning that my xcode-select is currently pointing at the command line tools, and not my Xcode installation. Perhaps that makes a difference?