LoginSignup
4
0

More than 1 year has passed since last update.

Ruby 3.2.0をインストールする時、"The Ruby openssl extension was not compiled."エラーが出てインストールできない場合の対策

Posted at

環境

  • MacBook Pro M1 Max
  • macOS 13.1 (Ventura)
  • rbenv 1.2.0-50-g593f820

問題

Ruby 3.2.0をインストールしている途中、以下のエラーが出ました。

Inspect or clean up the working tree at /var/folders/49/nz02t3_136xgn4jlw6z9r1q40000gn/T/ruby-build.20221229163135.84880.33u6aF
Results logged to /var/folders/49/nz02t3_136xgn4jlw6z9r1q40000gn/T/ruby-build.20221229163135.84880.log

Last 10 log lines:
ERROR: Ruby install aborted due to missing extensions
Configure options used:
  --prefix=/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0
  --enable-shared
  --with-readline-dir=/opt/homebrew/opt/readline
  --with-gmp-dir=/opt/homebrew/opt/gmp
  --with-openssl-dir=/usr/local/opt/openssl@1.1
  CC=clang
  LDFLAGS=-L/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0/lib -L/opt/homebrew/opt/imagemagick@6/lib
  CPPFLAGS=-I/Users/yuto/.anyenv/envs/rbenv/versions/3.2.0/include -I/opt/homebrew/opt/imagemagick@6/include

ログを確認したら以下の原因が分かりました。

The Ruby openssl extension was not compiled.

おそらくopenssl関連の問題が起きていると思われます。

解決策

openssl, readline, libyamlを再インストールします。

brew uninstall openssl@1.1 readline libyaml

それから以下のコマンドで無事にRuby 3.2.0がインスールできました。

export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
rbenv install 3.2.0
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0