Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install Ruby 2.6.5 on macOS 10.15 Catalina #1361

Closed
bforma opened this issue Oct 8, 2019 · 37 comments
Closed

Unable to install Ruby 2.6.5 on macOS 10.15 Catalina #1361

bforma opened this issue Oct 8, 2019 · 37 comments

Comments

@bforma
Copy link

bforma commented Oct 8, 2019

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?

@bforma
Copy link
Author

bforma commented Oct 8, 2019

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

@hsbt
Copy link
Member

hsbt commented Oct 8, 2019

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.

@bforma
Copy link
Author

bforma commented Oct 8, 2019

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

@bforma
Copy link
Author

bforma commented Oct 8, 2019

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

@bforma
Copy link
Author

bforma commented Oct 8, 2019

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.

@bforma bforma closed this as completed Oct 8, 2019
@mamantoha
Copy link

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.

@smorimoto
Copy link

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

@smorimoto
Copy link

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

@joshuapinter
Copy link

joshuapinter commented Oct 27, 2019

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

@smorimoto
Copy link

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.

@smorimoto
Copy link

Bash:

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

Fish:

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

@gnodnooh
Copy link

gnodnooh commented Oct 27, 2019

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

@joshuapinter
Copy link

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?

@smorimoto
Copy link

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"

@smorimoto
Copy link

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

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

@smorimoto
Copy link

@joshuapinter Could you try this?

@smorimoto
Copy link

@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).

@joshuapinter
Copy link

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.

@joshuapinter
Copy link

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

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

👍

@cocoonkid
Copy link

cocoonkid commented Dec 7, 2019

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/openssl@1.1/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/openssl@1.1/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/openssl@1.1/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/openssl@1.1/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

@smorimoto
Copy link

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

@jarod-legault
Copy link

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!

@smorimoto
Copy link

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

@joshuapinter
Copy link

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!

@iKK001
Copy link

iKK001 commented Dec 16, 2019

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 ?

@iKK001
Copy link

iKK001 commented Dec 17, 2019

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

@hipertracker
Copy link
Contributor

hipertracker commented Jan 22, 2020

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.

@smorimoto
Copy link

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

@smorimoto
Copy link

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

@iKK001
Copy link

iKK001 commented Jan 22, 2020

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

@hipertracker
Copy link
Contributor

hipertracker commented Jan 22, 2020 via email

@iKK001
Copy link

iKK001 commented Jan 22, 2020

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.

@hipertracker
Copy link
Contributor

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.

@kingshalaby1
Copy link

Remember to rbenv rehash after installing a new ruby version

@novibonjovi
Copy link

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.

@henrynguyen6677
Copy link

@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

@milushov
Copy link

milushov commented Jun 2, 2020

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

gemmaro pushed a commit to gemmaro/ruby-build that referenced this issue Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests