System の ruby とは別に開発用に ruby を install する on macOS
Android project で使ってる danger のメンテ (update とか) をできるようにする
gem, bundle, bundler というのが関わってくるぽいのでその辺の管理も必要そう
元々入ってる ruby 関連の環境に変更かけるのはまずそう
とりあえず rbenv 入れる
brew install rbenv ruby-build
とりあえず latest stable の 3.2.0 入れる
rbenv install 3.2.0
code:sh
BUILD FAILED (macOS 13.1 using ruby-build 20221225)
Inspect or clean up the working tree at /var/folders/<...>/T/ruby-build.20230110212304.49841.KvzFBY
Results logged to /var/folders/<...>/T/ruby-build.20230110212304.49841.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/<...>/T/ruby-build.20230110212304.49841.KvzFBY/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
オッダメだ
psych がどうの
To eliminate this warning, please install libyaml and reinstall your ruby.
ホーン
Ruby3.2.0のリリースノートによるとlibyamlやlibffiの同梱が廃止されたとのこと。別途インストールする必要がある。
Psych に同梱していた libyaml のソースコードは削除されました。ユーザーは自身で Ubuntu や Debian プラットフォームなら libyaml-dev パッケージをインストールする必要があります。このパッケージ名称はプラットフォームごとに異なります。
そういうこと
brew install libyaml
気を取り直してもういちど 3.2.0 の install
成功した
rbenv で install した方の ruby を使うようにする (今回は 3.2.0)
rbenv global 3.2.0
rbenv global で今使ってる ruby が何かわかる (system のは system ってひょうじされる)
rbenv versions で指定可能な (= install 済みの) 候補の一覧が見られる
gem install bundler で bundler と bundle が入る