昨年末Ruby 3.2.0がリリースされましたね🎅🎄✨
今更ながらローカルのRubyのバージョンをrbenvで3.2.0に上げようと思ったのですがエラーが発生したのでその対応方法とかをメモ📝
発生した問題
いつもどおり以下のコマンドでRuby 3.2.0をisntallしようとしたのですが、以下の通りエラーが発生し失敗しました😵
$ brew update && brew upgrade ruby-build $ rbenv install 3.2.0 ruby-build: using readline from homebrew BUILD FAILED (macOS 12.6.3 using ruby-build 20230124) Inspect or clean up the working tree at /var/folders/59/r452z9h94xn9py1wt_ffj8qh0000gn/T/ruby-build.20230128163250.53460.gt7TJp Results logged to /var/folders/59/r452z9h94xn9py1wt_ffj8qh0000gn/T/ruby-build.20230128163250.53460.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/59/r452z9h94xn9py1wt_ffj8qh0000gn/T/ruby-build.20230128163250.53460.gt7TJp/ruby-3.2.0/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
解決方法
以下のrbenv/ruby-build
のDiscussion記載の通り、
libyaml
をinstallしてからRuby 3.2.0をinstallすることで解決しました🎉
$ brew install libyaml $ rbenv install 3.2.0 $ rbenv global 3.2.0 $ ruby -v ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin21]