Hello,
I'm opening a new issue because I commented on a closed issue and I'm not sure I'd have any help there.
I recently did a fresh macOS install of Catalina (no upgrade) and I need to install Ruby 2.2.0 for my work.
Ruby seems to build successfully but when it comes to installing gem, it fails and seems not to find zlib:
brew install zlib rbenv ruby-build
brew install rbenv/tap/[email protected]
# ...
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" rbenv install 2.2.0
Downloading ruby-2.2.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.bz2
Installing ruby-2.2.0...
WARNING: ruby-2.2.0 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
BUILD FAILED (Mac OS X 10.15.6 using ruby-build 20200819)
Inspect or clean up the working tree at /var/folders/zr/xscq74t95293jr3k2dj75pyw0000gn/T/ruby-build.20200917111734.72324.wL7hCD
Results logged to /var/folders/zr/xscq74t95293jr3k2dj75pyw0000gn/T/ruby-build.20200917111734.72324.log
Last 10 log lines:
from /private/var/folders/zr/xscq74t95293jr3k2dj75pyw0000gn/T/ruby-build.20200917111734.72324.wL7hCD/ruby-2.2.0/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
from /private/var/folders/zr/xscq74t95293jr3k2dj75pyw0000gn/T/ruby-build.20200917111734.72324.wL7hCD/ruby-2.2.0/lib/rubygems.rb:556:in `install'
from ./tool/rbinstall.rb:717:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:716:in `each'
from ./tool/rbinstall.rb:716:in `block in <main>'
from ./tool/rbinstall.rb:749:in `call'
from ./tool/rbinstall.rb:749:in `block in <main>'
from ./tool/rbinstall.rb:746:in `each'
from ./tool/rbinstall.rb:746:in `<main>'
make: *** [do-install-all] Error 1
zsh: exit 1
Full log: ruby-build.20200917111734.72324.log
Doctor output:
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20200819)
Counting installed Ruby versions: none
There aren't any Ruby versions installed under `/Users/eexit/.rbenv/versions'.
You can install Ruby versions like so: rbenv install 2.2.4
Checking RubyGems settings: OK
Auditing installed plugins: OK
I tried to reinstall Xcode but did not work.
I also tried using the following flags but did not work:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected]) --with-zlib-dir=$(brew --prefix zlib)" rbenv install 2.2.0
Any help would be greatly appreciated.
Thanks!
Hi, I was having the same problem, and after many trials and errors, this is what helped me:
sudo rm -rf /Library/Developer/CommandLineToolsXcode-select --print-pathsudo xcode-select -switch /Library/Developer/CommandLineTools since it was not the correct path. I hope this helps you, or maybe you already solved the issue. Then I could install Ruby without problems.
@eexit once you have command line tools downgraded to version 11, as @aydamacink describes (clang --version should be reporting 11.[something]), i've found that you don't need to do anything special with RUBY_CONFIGURE_OPTS and it seems like using openssl from homebrew might be counterproductive. i've only seen zlib errors when pointing to homebrew openssl with RUBY_CONFIGURE_OPTS. so hopefully brew install 2.2.0 works for you like it did for me with the opensll that ruby-build installs itself.
Hello,
Thank you for your answers. So, I downloaded Command Line Tools 11.5 and installed it.
$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I removed the homebrew OpenSSL and zlib.
Then I ran rbenv install 2.2.0:
Downloading openssl-1.0.2u.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/eexit/.rbenv/versions/2.2.0
Downloading ruby-2.2.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.bz2
Installing ruby-2.2.0...
WARNING: ruby-2.2.0 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-2.2.0 to /Users/eexit/.rbenv/versions/2.2.0
It worked like a charm. Thank you very much 馃憤
Thanks @aydamacink I was stuck on it for days.
Hi, I was having the same problem, and after many trials and errors, this is what helped me:
- I tried installing Xcode again through the command line, but I got an error like not available on the server.
- I read you cannot install it well without uninstalling completely previous installs, so I did
sudo rm -rf /Library/Developer/CommandLineTools- I downloaded the command line Tools for XCode version 11.5 (I am using Catalina 10.15.6), and the next version, 12, is for Big Sur that will come out next month. Here is the link: Command line tools for Xcode Installation
- When the installation finished, I restarted the computer
- I checked the path of these tools:
Xcode-select --print-path- Finally, I ran
sudo xcode-select -switch /Library/Developer/CommandLineToolssince it was not the correct path.I hope this helps you, or maybe you already solved the issue. Then I could install Ruby without problems.
It's required to be an apple developer to download the Command Line Tools through this link.
There's an alternative link able to download the Command Line Tools without being an apple developer.
Hi, I was having the same problem, and after many trials and errors, this is what helped me:
- I tried installing Xcode again through the command line, but I got an error like not available on the server.
- I read you cannot install it well without uninstalling completely previous installs, so I did
sudo rm -rf /Library/Developer/CommandLineTools- I downloaded the command line Tools for XCode version 11.5 (I am using Catalina 10.15.6), and the next version, 12, is for Big Sur that will come out next month. Here is the link: Command line tools for Xcode Installation
- When the installation finished, I restarted the computer
- I checked the path of these tools:
Xcode-select --print-path- Finally, I ran
sudo xcode-select -switch /Library/Developer/CommandLineToolssince it was not the correct path.I hope this helps you, or maybe you already solved the issue. Then I could install Ruby without problems.
This is a great suggestion, got me out of a months long funk with my ruby set up with rvm.
Inspired by this solution the following worked for me:
export optflags="-Wno-error=implicit-function-declaration"
rbenv install 2.1.2
Setting RUBY_CONFIGURE_OPTS or CFLAGS had no effect. Also downgrading the command line tools didn't worked for me, because version 11.x is not supported by macOS 11.2.3 any more.
Most helpful comment
Hi, I was having the same problem, and after many trials and errors, this is what helped me:
sudo rm -rf /Library/Developer/CommandLineToolsXcode-select --print-pathsudo xcode-select -switch /Library/Developer/CommandLineToolssince it was not the correct path.I hope this helps you, or maybe you already solved the issue. Then I could install Ruby without problems.