ruby-build: Ruby 2.4.1 build failed on macOS Sierra 10.12.3
Ruby 2.4.1 build fails on macOS Sierra 10.12.3, below the log I got
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.12.3 using ruby-build 20170201)
Inspect or clean up the working tree at /var/folders/j2/90b3sd_j3fqcgc2yxp_wwc600000gq/T/ruby-build.20170326214012.36750
Results logged to /var/folders/j2/90b3sd_j3fqcgc2yxp_wwc600000gq/T/ruby-build.20170326214012.36750.log
Last 10 log lines:
../.././include/ruby/ruby.h:2166:6: note: expanded from macro 'rb_scan_args_count_block'
rb_scan_args_count_end(fmt, ofs, varc, vari) : \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../.././include/ruby/ruby.h:2162:12: note: expanded from macro 'rb_scan_args_count_end'
((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt)))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 warnings and 1 error generated.
make[2]: *** [ossl_x509store.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
cat /var/folders/j2/90b3sd_j3fqcgc2yxp_wwc600000gq/T/ruby-build.20170326214012.36750.log | grep -i error
checking for ERRORFUNC function attribute... x
checking for strerror... yes
CFLAGS = -O3 -Wno-error=shorten-64-to-32 -pipe
compiling error.c
compiling regerror.c
compiling dataerror.c
ossl_x509store.c:175:16: error: member reference type 'int' is not a pointer
13 warnings and 1 error generated.
make[2]: *** [ossl_x509store.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make: *** [build-ext] Error 2
my openssl is the latest:
brew info openssl
openssl: stable 1.0.2k (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2d_1 (1,638 files, 12.1M)
Poured from bottle on 2015-07-13 at 20:46:23
/usr/local/Cellar/openssl/1.0.2k (1,696 files, 12M)
Poured from bottle on 2017-02-03 at 07:32:39
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Dependencies
Build: makedepend ✘
==> Options
--universal
Build a universal binary
--without-test
Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
brew upgrade openssl
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
bash-git-prompt checkstyle idris
Error: openssl 1.0.2k already installed
Any suggestion?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 23 (4 by maintainers)
I had same issue after migration to new macbook pro using peer to peer migration, looks like Homebrew env crashed. I fixed it by delete the brew include files:
sudo mv /usr/local/include /usr/local/include_oldI fixed my issue. It was because of a leftover
opensslinstall, plus some missing ENV variables that appeared in later brewopensslversions. In any case:brew updatebrew unlink opensslbrew uninstall --ignore-dependencies opensslbrew install opensslrbenv install 2.4.1Thanks everyone for sharing your workarounds!
Closing due to staleness. Hopefully people don’t have this problem anymore.
I was having the same issue.
MacOS Version 10.13.2 (17C88) Ruby 2.4.2 OpenSSL 1.0.2n
I resolved with
https://github.com/Homebrew/brew/pull/597
Here is the solution!!! It works for me! brew update brew install openssl ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/Cellar/openssl/1.0.2j/bin/openssl openssl ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/dotnet
even after using @mwxclauss solution (and @shuriu), you will probably still get BUILD ERROR with line like
The reason is because rbenv still use old system “curl”, which knows nothing about your new “openssl v 1.1” (I used
brew install openssl@1.1). For me, installing new version of curl with brew did the work:Then add installed curl to your PATH (before default path, which is
/usr/bin), and ensure that openssl of actual brew’s version is also there:You can make sure after relaunch of terminal that latest versions of this programs will be used by trying
First two commands should output all paths with the programs, but top ones should be brew versions. Last two commands should show latest versions of programs (1.1.0f and 7.55 for me now).
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 curl 7.57.0
rbenv, curl, openssl - all in PATH
Tried all solutions listed above - nothing helped. Any suggestion?
I was Unable to install
ruby 2.4.1withopensslbut I I was able to install withopenssl@1.1brew uninstall openssl --ignore-dependenciesI had a1.0.1lversion.brew cleanupbrew install openssl@1.1installedopenssl@1.1: stable 1.1.0f (bottled) [keg-only]export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"in my~/.bashrcfilerbenv install 2.4.1(previously upgraded ruby-build)It seems the install downloaded openssl as part of ruby installation. Does that mean ruby-build did not use the
openssl@1.1installed in previous step?My install output shows
When I type
brew missingI still see I am missingopenssleven if I haveopenssl@1.1installed andPATHto it set.@shuriu your solution worked for me. Thank You.