0

I can't install ruby 3.0.3. Tried many different options.

rbenv install 3.0.3
Downloading openssl-1.1.1l.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1
Installing openssl-1.1.1l...
Installed openssl-1.1.1l to /Users/admin/.rbenv/versions/3.0.3

Downloading ruby-3.0.3.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz
Installing ruby-3.0.3...
ruby-build: using readline from homebrew

BUILD FAILED (macOS 12.2.1 using ruby-build 20220125)

Inspect or clean up the working tree at /var/folders/7_/240gy0092fj2gcm9bvzyls480000gp/T/ruby-build.20220214200956.30377.QArDjF
Results logged to /var/folders/7_/240gy0092fj2gcm9bvzyls480000gp/T/ruby-build.20220214200956.30377.log

Last 10 log lines:
/usr/local/include/stdlib.h:361:13: note: insert '_Nonnull' if the pointer should never be null
extern char *suboptarg;         /* getsubopt(3) external variable */
            ^
              _Nonnull
219 warnings generated.

Install log mostly consists of the lines like this

In file included from /usr/local/include/stdio.h:64:
/usr/local/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
        unsigned char   *_base;
                        ^
/usr/local/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
        unsigned char   *_base;

MacOS Monterey 12.2.1, rbenv 1.2.0, ruby-build 20220125. Same happened back when I was on Big Sur (so I upgraded but no luck).

brew outdated gives nothing. I also tried reinstalling gcc, command line tools and did everything suggested by brew doctor.

Any help appreciated!

Al17
  • 431
  • 7
  • 20

1 Answers1

1

There were lots of issues related to linking of openssl and possibly smth else.

Solution:

brew update
brew upgrade
brew install llvm
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install 3.0.3

Find an answer in the thread here: https://github.com/rbenv/ruby-build/discussions/1935#discussioncomment-2267934

Al17
  • 431
  • 7
  • 20