Ruby-build: Unable to install Ruby 2.6.5 on macOS 10.15 Catalina

Created on 8 Oct 2019  ·  37Comments  ·  Source: rbenv/ruby-build

Hi,

I'm trying to rbenv install 2.6.5 after upgrading from Mojave to Catalina and I am getting the following error(s):

rbenv install
ruby-build: using openssl from homebrew
Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...
ruby-build: using readline from homebrew

BUILD FAILED (OS X 10.15 using ruby-build 20191004)

Inspect or clean up the working tree at /var/folders/j8/dw62n33d4gl3y2nzr_ky09400000gn/T/ruby-build.20191008094457.36804
Results logged to /var/folders/j8/dw62n33d4gl3y2nzr_ky09400000gn/T/ruby-build.20191008094457.36804.log

Last 10 log lines:
int     sigvec(int, struct sigvec *, struct sigvec *);
                                                   ^
                                                    _Nonnull
190 warnings generated.
190 warnings generated.
216 warnings generated.
190 warnings generated.
216 warnings generated.
190 warnings generated.
221 warnings generated.

Any clue on how to fix this?

Most helpful comment

@bforma @mamantoha Try this SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk".

All 37 comments

This seems to be the culprit: file.c:23:10: fatal error: 'CoreFoundation/CFString.h' file not found

I could install 2.6.5 with Catalina

‚ùØ rbenv install 2.6.5
ruby-build: using openssl from homebrew
Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...
ruby-build: using readline from homebrew
Installed ruby-2.6.5 to /Users/hsbt/.local/share/rbenv/versions/2.6.5

Maybe, you need to invoke xcode-select --install again.

@hsbt Thanks for the tip. Tried that and the results are the same :(

I've set CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include, otherwise there is a complaint that stdio.h cannot be found.

Got it working. Apparently I had an old version (6) of llvm linked via brew (thus also using an old version of clang). brew unlink llvm@6 fixed that. Also needed to unset CPATH.

Thanks @bforma . I have the same issue.

Actually unlinking llvm didn't help me.
I completely uninstall all llvm versions via brew. And then it was fixed.

@bforma @mamantoha Try this SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk".

I don't think this is a perfect solution, but it works well as a temporary solution.

I had a different error but trying to do the same thing and related to openssl.

The system version of openssl was using libressl and an old one at that. To fix it I had to do the following:

  1. Backup your existing openssl:

    $ sudo mv /usr/bin/openssl /usr/bin/openssl-old
    

    _NOTE: You may need to turn off SIP (System Integrity Protection) by booting into Recovery Mode and running csrutil disable. You may also need to re-mount your root drive as writeable with sudo mount -uw /._

  2. Install openssl from Brew:

    $ brew install openssl
    
  3. Verify the new version:

    $ openssl version
    OpenSSL 1.0.2t  10 Sep 2019
    

Any solution that requires disabling SIP is a very bad idea. and probably you just need to add the path to the OpenSSL which installed by brew.

Bash:

export PATH=$PATH:/usr/local/opt/openssl/bin

Fish:

set -x PATH /usr/local/opt/openssl/bin $PATH

I have the same issue, and I found my case was due to conflictions with anaconda environment. I simply deactivated conda environment in my terminal and re-installed rbenv successfully. If you see error: cannot run C compiled programs, please try $ CC=gcc rbenv install 2.6.x

Any solution that requires disabling SIP is a very bad idea. and probably you just need to add the path to the OpenSSL which installed by brew.

To be clear, you can reenable it after updating openssl by rebooting into recovery mode and using csrutil enable in the Terminal.

export PATH=$PATH:/usr/local/opt/openssl/bin

Do you know if this will use brew's openssl if the system has openssl already?

I know. and it's not good solution for many people who work for companies. because many companies don't like to disable at least the standard OS security options.

Well if you want to specify it explicitly, you should be able to do with these flags.

CFLAGS="-I/usr/local/opt/openssl/include"
LDFLAGS="-L/usr/local/opt/openssl/lib"

Oh, probably RUBY_CONFIGURE_OPTS is good for ruby-build users.

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install [version]

@joshuapinter Could you try this?

@bforma @mamantoha Problems on the macOS related with LLVM have been fixed in https://github.com/Homebrew/homebrew-core/pull/45304 and it has been merged today so it's already available in the latest brew.

Could you try this?

brew update
brew upgrade
brew uninstall llvm
brew install llvm

You can check statuses of other LLVM versions can be seen in https://github.com/Homebrew/homebrew-core/issues/45061#issuecomment-547671808.

Oh, probably RUBY_CONFIGURE_OPTS is good for ruby-build users.

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install [version]

I believe this will work as well if you're unable or unwilling to disable SIP. Give me a bit and I'll restore the old version and see if this solves it.

I tried but couldn't reproduce the initial issue. 🤷‍♂

So, for others, it's worth trying this solution before replacing the system's openssl.

👍

I tried all of these but cannot get it work.

openssl version
OpenSSL 1.1.1d 10 Sep 2019

rbenv install 2.6.5
Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...

BUILD FAILED (OS X 10.15.1 using ruby-build 20191205)

Inspect or clean up the working tree at /var/folders/_v/q9b0p1vn60j7r231n0qfwxtc0000gn/T/ruby-build.20191207124022.48565.zs8yAo
Results logged to /var/folders/_v/q9b0p1vn60j7r231n0qfwxtc0000gn/T/ruby-build.20191207124022.48565.log

Last 10 log lines:
clang  -I. -Iinclude -fPIC -arch x86_64 -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/ssl\"" -DENGINESDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/usr/local/opt/rbenv/versions/2.6.5/include -I/usr/local/opt/[email protected]/include -MMD -MF apps/app_rand.d.tmp -MT apps/app_rand.o -c -o apps/app_rand.o apps/app_rand.c
clang  -I. -Iinclude -fPIC -arch x86_64 -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/ssl\"" -DENGINESDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/usr/local/opt/rbenv/versions/2.6.5/include -I/usr/local/opt/[email protected]/include -MMD -MF apps/apps.d.tmp -MT apps/apps.o -c -o apps/apps.o apps/apps.c
clang  -I. -Iinclude -fPIC -arch x86_64 -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/ssl\"" -DENGINESDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/usr/local/opt/rbenv/versions/2.6.5/include -I/usr/local/opt/[email protected]/include -MMD -MF apps/bf_prefix.d.tmp -MT apps/bf_prefix.o -c -o apps/bf_prefix.o apps/bf_prefix.c
clang  -I. -Iinclude -fPIC -arch x86_64 -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/ssl\"" -DENGINESDIR="\"/usr/local/opt/rbenv/versions/2.6.5/openssl/lib/engines-1.1\"" -D_REENTRANT -DZLIB -DZLIB_SHARED -DNDEBUG -I/usr/local/opt/rbenv/versions/2.6.5/include -I/usr/local/opt/[email protected]/include -MMD -MF apps/opt.d.tmp -MT apps/opt.o -c -o apps/opt.o apps/opt.c
apps/opt.c:175:10: error: missing field 'retval' initializer [-Werror,-Wmissing-field-initializers]
    {NULL}
         ^
1 error generated.
make[1]: *** [apps/opt.o] Error 1
make: *** [all] Error 2

@cocoonkid Have you set RUBY_CONFIGURE_OPTS? Have you installed openssl with brew?

I tried but couldn't reproduce the initial issue. 🤷‍♂

So, for others, it's worth trying this solution before replacing the system's openssl.

👍

@joshuapinter and @imbsky I was able to install ruby using RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install and it worked great. Thanks for finding solutions for this issue!

@jarod-legault I'm glad to hear that! Have a good rbenv life.

I tried but couldn't reproduce the initial issue. 🤷‍♂
So, for others, it's worth trying this solution before replacing the system's openssl.
👍

@joshuapinter and @imbsky I was able to install ruby using RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install and it worked great. Thanks for finding solutions for this issue!

🙌 Thanks for confirming!

Does not work. I tried: RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.6.5
But I still get the same Error BUILD FAILED (OS X 10.15.2 using ruby-build ...)

I try gem install bundler- but get the following error:

ERROR: While executing gem ... (Errno::EACCES)
Permission denied @ rb_sysopen - /Users/cibuild/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.1.0/CHANGELOG.md

What else can I do ?

What finally helped what to recognise that the Ruby version installed needed the following permission setting:

sudo chown -R YOURUSER:staff /Users/YOURUSER/.rbenv

Found it here :
miroslav's solution

Nothing works. :( I use macOS Catalina v10.15.2. I just can't install Ruby with rbenv (I mean: ruby-build) Although brew install ruby works.

It doesn't matter because brew only downloads and installs pre-built stuff unless you specify it with a flag.

Have you tried the way I showed you above? I don't know how to help you because I don't have any information.

Here is how it normally works for me (MacOS Catalina 10.15.2):

To Install other Ruby version, do the following steps

Use rbenv:  https://github.com/rbenv/rbenv

1. Install homebrew (https://brew.sh)
(do first line from the website is enough)

2a. Install rbenv: Open Terminal and write:
brew install rbenv 

2b. Eventually update rbenv (if you come in later you can continue from here…):
brew upgrade rbenv ruby-build

3. Set up rbenv in your shell:
rbenv init

4. Open ~/.bash_profile   (you can write nano ~/.bash_profile)
And add the following line to your bash_profile file:
eval "$(rbenv init -)"

(hint to save and exit from  nano after you made sure the above line is now inside your  bash_profile:
a. hit Ctrl-O
b. hit Enter
c. hit Ctrl-X
(re-open bash_profile to check that the above line is now present)

5. Restart your computer

6. Run doctor script - everything should look OK
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

7. Find you what Ruby version you want to install. The following list them all:
rbenv install -l

8. Install your ruby version of choice:
rbenv install 2.6.5
If Error - eventually do:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.6.5
(As described here: https://github.com/rbenv/ruby-build/issues/1361)

9. Install Ruby gems:
sudo gem install bundler

10. Check the location where gems are located:
sudo gem env home

„Restart your computer” - really? :)

On Wed 22 Jan 2020 at 08:20, iKK001 notifications@github.com wrote:

Here is how it normally works for me (MacOS Catalina 10.15.2):

Install other Ruby version

Use rbenv: https://github.com/rbenv/rbenv

  1. Install homebrew (https://brew.sh)

(do first line is enough)

2a. Install rbenv: Open Terminal and write:

brew install rbenv

2b. Eventually update rbenv (if you come in later you can continue from here…):

brew upgrade rbenv ruby-build

  1. Set up rbenv in your shell:

rbenv init

  1. Open ~/.bash_profile (you can write nano ~/.bash_profile)
    And add the following line to your bash_profile file:
    eval "$(rbenv init -)"

  2. Restart your computer

  3. Run doctor script - everything should look OK
    curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash

  4. Find you what Ruby version you want to install. The following list them all:

rbenv install -l

  1. Install your ruby version of choice:

rbenv install 2.6.5
If Error - eventually do:
RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.6.5

(As described here: https://github.com/rbenv/ruby-build/issues/1361)

  1. Install Ruby gems:

sudo gem install bundler

  1. Check the location where gems are located:

sudo gem env home


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/rbenv/ruby-build/issues/1361?email_source=notifications&email_token=AAAAFCP4ZKRCQXUSSHWH2RLQ676T5A5CNFSM4I6PHTZ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJSUB5Q#issuecomment-577061110,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAAFCMUNGKXPPT2GGTHIEDQ676T5ANCNFSM4I6PHTZQ
.

smile - I used to work with Windows and this reflex is somehow in my spine... ;)
And believe it or not, the above list is what I collected from different forum entries (incl. restart) and it helped me, bullet-proof, to install a new ruby version. So I left the restart-step in the list.

This is nothing new. I tried it all before. It does NOT work. Worse, I have created the latest Ubuntu server in Docker and tried to install Ruby 2.7.0 with ruby-build. It also has failed! It looks bad.
I can install 2.6.5 with Homebrew, but I want 2.7.0.
I can install TruffleRuby from GraalVM but it can also install the older Ruby version.
Does nobody provide binaries for Ruby 2.7.0? Strange. It has been published a month ago.

Remember to rbenv rehash after installing a new ruby version

Oh, probably RUBY_CONFIGURE_OPTS is good for ruby-build users.

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl)" rbenv install [version]

I believe this will work as well if you're unable or unwilling to disable SIP. Give me a bit and I'll restore the old version and see if this solves it.

This one worked for me.
My openssl was linked to libressl.

@bforma @mamantoha Problems on the macOS related with LLVM have been fixed in Homebrew/homebrew-core#45304 and it has been merged today so it's already available in the latest brew.

Could you try this?

brew update
brew upgrade
brew uninstall llvm
brew install llvm

You can check statuses of other LLVM versions can be seen in Homebrew/homebrew-core#45061 (comment).

Thank you very much.
I install rvm, rbenv and make source ruby but fired errors.
This is exactly solution for me.

brew update
brew upgrade
brew install llvm
rbenv install 2.7.1
rbenv rehash

Guys, does anyone experienced that ruby started load 100% CPU after upgrading macOS Catalina up to 10.15.5 (19F96)?

ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artoodeeto picture artoodeeto  ·  4Comments

ghost picture ghost  ·  4Comments

kriscard picture kriscard  ·  5Comments

denisemauldin picture denisemauldin  ·  4Comments

fguillen picture fguillen  ·  5Comments