ruby-build: Ruby 2.4.1 build failed on macOS High Sierra 10.13.2

Struggling with getting rbenv up and running on my mac:

macOS 10.13.2 rbenv 1.1.1 OpenSSL 1.1.0g 2 Nov 2017 (tried different without specifying 1.1 as well) curl 7.57.0

% which rbenv
/usr/local/bin/rbenv
% which openssl
/usr/local/opt/openssl@1.1/bin/openssl
% which curl
/usr/local/opt/curl/bin/curl

rbenv, curl, openssl - all in PATH

% rbenv install 2.4.1
ruby-build: use openssl from homebrew
Downloading ruby-2.4.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.1.tar.bz2
Installing ruby-2.4.1...

BUILD FAILED (OS X 10.13.2 using ruby-build 20171215)

Inspect or clean up the working tree at /var/folders/31/41tck3qx69scnynksxc_38ch0000gn/T/ruby-build.20171220150125.94300
Results logged to /var/folders/31/41tck3qx69scnynksxc_38ch0000gn/T/ruby-build.20171220150125.94300.log

Last 10 log lines:
checking for long long... yes
checking for off_t... yes
checking char bit... 8
checking size of int... 0
checking size of short... 0
checking size of long... 0
checking size of long long... configure: error: in `/var/folders/31/41tck3qx69scnynksxc_38ch0000gn/T/ruby-build.20171220150125.94300/ruby-2.4.1':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details
make: *** No targets specified and no makefile found.  Stop.

Tried all solutions listed above - nothing helped. Any suggestion?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Most upvoted comments

I have had the same issue but I am able to fix it by doing the following steps:

  1. sudo mv /usr/local/include /usr/local/include_old
  2. RUBY_CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.4.1

I had the same issue and here is how I fixed it (thanks to a lot a googling)

$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

then follow the installation until the end (next, next, next,…) and then install like you usually do:

$ rbenv install 2.5.5

Its almost 2020 and still I got this error. This is how I solved it

First run

$ brew uninstall openssl
$ brew --prefix openssl
$ sudo mv /usr/local/include /usr/local/include_old
$ rm ~/.rbenv

Add path found with brew --prefix openssl to .zshrc

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

Open new terminal or source RC file

$ rbenv install 2.5.1
$ rbenv global 2.5.1
$ ruby --version

It looks like you’re having problems with ruby-build, which is the plugin that provides rbenv-install.

  1. First, ensure that ruby-build is updated to the latest version.
  2. If your problem persists, check existing issues in the ruby-build repo and open a new one if necessary. When opening a new issue, please attach the full build log.

@thegreyfellow this seeeeeems to be working? 🤞 I’m not getting errors about “cross compiling C programs” and “–host” flags anymore, but my fans are going crazy and it’s stalled at Installing ruby-2.3.8... ruby-build: use readline from homebrew for aaaages 😢

Update: OMG it worked! Took for EVER to run, though… Thank you so much! ❤️