概要
rbenvからの「Ruby3.2.1」インストールで
以下のエラーが発生していたため、その解決方法を記録しておきます。
Last 10 log lines:
Check ext/psych/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
Generating RDoc documentation
/private/var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325134318.81087.mVBPCC/ruby-3.2.1/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych
開発環境
- macOS Ventura 13.2.1
- MacBookPro M2 Pro
rbenvをインストール
$ brew install rbenv ruby-build
rbenvインストールは問題なかった
rbenvからRuby3.2.1をインストールしてみるが、失敗
$ rbenv install 3.2.1
To follow progress, use 'tail -f /var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325134318.81087.log' or pass --verbose
Downloading openssl-3.0.8.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e
Installing openssl-3.0.8...
Installed openssl-3.0.8 to /Users/hoge/.rbenv/versions/3.2.1
Downloading ruby-3.2.1.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.1.tar.gz
Installing ruby-3.2.1...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 13.2.1 using ruby-build 20230309)
Inspect or clean up the working tree at /var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325134318.81087.mVBPCC
Results logged to /var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325134318.81087.log
Last 10 log lines:
Check ext/psych/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.
Generating RDoc documentation
/private/var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325134318.81087.mVBPCC/ruby-3.2.1/lib/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
uh-oh! RDoc had a problem:
cannot load such file -- psych
run with --debug for full backtrace
make: *** [rdoc] Error 1
インストール失敗。
エラーメッセージ↓を確認したところ、libyamlに問題があった模様。
please install libyaml and reinstall your ruby.
libyamlをインストールしてみる
#### libyaml確認。(インストールされていなかった。)
$ brew info libyaml
==> libyaml: stable 0.2.5 (bottled)
YAML Parser
https://github.com/yaml/libyaml
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/libyaml.rb
License: MIT
==> Dependencies
Build: autoconf ✔, automake ✘, libtool ✘
==> Analytics
install: 2,507 (30 days), 193,777 (90 days), 1,024,167 (365 days)
install-on-request: 350 (30 days), 40,851 (90 days), 191,915 (365 days)
build-error: 1 (30 days)
#### libyamlをインストール
$ brew install libyaml
再度rbenvからRuby3.2.1をインストール
$ rbenv install 3.2.1
To follow progress, use 'tail -f /var/folders/gt/wrmndzvn7nqfx827qvt8k4zh0000gn/T/ruby-build.20230325140543.73012.log' or pass --verbose
Downloading openssl-3.0.8.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e
Installing openssl-3.0.8...
Installed openssl-3.0.8 to /Users/hoge/.rbenv/versions/3.2.1
Downloading ruby-3.2.1.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.1.tar.gz
Installing ruby-3.2.1...
ruby-build: using readline from homebrew
ruby-build: using libyaml from homebrew
Installed ruby-3.2.1 to /Users/hoge/.rbenv/versions/3.2.1
問題なくインストールできた。
参考資料