LoginSignup

Are you sure you want to delete the question?

Leaving a resolved question undeleted may help others!

Ruby環境構築 rbenv install 3.0.0でopensslエラーが起きます。。

解決したいこと

Rubyの環境構築で、rbenv install 3.0.0でopensslのエラーが出ました。
この事象の解消方法を教えていただきたいです。

環境

環境 バージョン 備考
macOS 11.2.x(Big Sur)
Homebrew 3.0.1
rbenv 1.1.2
Ruby 2.6.3p62 気づいたら、入っていました。

.bash系ではなく.zsh_profile, .zshrcを使用しています。
設定には下記のサイトを参考にしました。
Install Ruby On Rails on macOS 11.0 Big Sur
https://gorails.com/setup/osx/11.0-big-sur

発生している問題・エラー

まずは単純に rbenv から 3.0.0 のインストールを実行した。
(${USER} はログインユーザを示す)

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

BUILD FAILED (macOS 11.2.1 using ruby-build 20210119)

Inspect or clean up the working tree at /var/folders/lt/g7px01z1599_tqqmng32w8400000gn/T/ruby-build.20210218112623.38382.FNQzlc
Results logged to /var/folders/lt/g7px01z1599_tqqmng32w8400000gn/T/ruby-build.20210218112623.38382.log

Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/${USER}/.rbenv/versions/3.0.0
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  --enable-shared
  --with-readline-dir=/usr/local/opt/readline
  CC=clang
  LDFLAGS=-L/Users/${USER}/.rbenv/versions/3.0.0/lib -L/usr/local/opt/ruby/lib
  CPPFLAGS=-I/Users/${USER}/.rbenv/versions/3.0.0/include -I/usr/local/opt/ruby/include

その後、色々とググって次は下記のコマンドで実施。
しかし、同様のエラーが発生。

% RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 3.0.0
Downloading ruby-3.0.0.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.0.tar.gz
Installing ruby-3.0.0...

BUILD FAILED (macOS 11.2.1 using ruby-build 20210119)

Inspect or clean up the working tree at /var/folders/lt/g7px01z1599_tqqmng32w8400000gn/T/ruby-build.20210218115257.84809.3GuK6s
Results logged to /var/folders/lt/g7px01z1599_tqqmng32w8400000gn/T/ruby-build.20210218115257.84809.log

Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/${USER}/.rbenv/versions/3.0.0
  --with-readline-dir=/usr/local/opt/readline
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  --enable-shared
  CC=clang
  LDFLAGS=-L/Users/${USER}/.rbenv/versions/3.0.0/lib -L/usr/local/opt/ruby/lib
  CPPFLAGS=-I/Users/${USER}/.rbenv/versions/3.0.0/include -I/usr/local/opt/ruby/include

どうすれば、無事Rubyをインストールできるでしょうか?
ご教授願います。。

自分で試したこと

参考に実施したサイトは下記です。
[Ruby] rbenv で「The Ruby openssl extension was not compiled.」が発生したときの対処
https://qiita.com/ksh-fthr/items/299684eec4e05cc607d7
rbenv installができない
https://teratail.com/questions/285547
Install Ruby On Rails on macOS 11.0 Big Sur
https://gorails.com/setup/osx/11.0-big-sur

0

No Answers yet.

Your answer might help someone💌