以前、古いバージョンの Ruby がインストールできない、という記事を書いたが、また遭遇してしまった。 Ruby 2.6.5 である。
今回はプロダクトオーナーでもコーダーでもないので、ガッとパッと環境を更新することができない。 ということで M1(Pro) な環境で 2.6.5 をインストールできるようにしてみた。
エラー全文
❯ rbenv install 2.6.5 To follow progress, use 'tail -f /var/folders/np/w6ml9cp529j92kms59xq43lr0000gn/T/ruby-build.20230105190556.10654.log' or pass --verbose Downloading openssl-1.1.1s.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa Installing openssl-1.1.1s... Installed openssl-1.1.1s to /Users/donbulinux/.anyenv/envs/rbenv/versions/2.6.5 Downloading ruby-2.6.5.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2 Installing ruby-2.6.5... WARNING: ruby-2.6.5 is past its end of life and is now unsupported. It no longer receives bug fixes or critical security updates. ruby-build: using readline from homebrew ruby-build: using gmp from homebrew BUILD FAILED (macOS 13.1 using ruby-build 20221225-2-ga02df97) Inspect or clean up the working tree at /var/folders/np/w6ml9cp529j92kms59xq43lr0000gn/T/ruby-build.20230105190556.10654.W7a8Cc Results logged to /var/folders/np/w6ml9cp529j92kms59xq43lr0000gn/T/ruby-build.20230105190556.10654.log Last 10 log lines: transform_mjit_header: SKIPPED to transform __sputc linking shared-library libruby.2.6.dylib transdb.h updated ln -sf ../../../.ext/include/-darwin22/rb_mjit_min_header-2.6.5.h include/ruby-2.6.0/-darwin22/rb_mjit_min_header-2.6.5.h Undefined symbols for architecture arm64: "__mh_execute_header", referenced from: _rb_dump_backtrace_with_lines in addr2line.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libruby.2.6.dylib] Error 1
どうする
こうする。
❯ RUBY_CFLAGS="-w" rbenv install 2.6.5
RUBY_CFLAGS="-w"
これつけるだけ。 無事回避できた。
To follow progress, use 'tail -f /var/folders/np/w6ml9cp529j92kms59xq43lr0000gn/T/ruby-build.20230105191434.49851.log' or pass --verbose Downloading openssl-1.1.1s.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa Installing openssl-1.1.1s... Installed openssl-1.1.1s to /Users/donbulinux/.anyenv/envs/rbenv/versions/2.6.5 Downloading ruby-2.6.5.tar.bz2... -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2 Installing ruby-2.6.5... WARNING: ruby-2.6.5 is past its end of life and is now unsupported. It no longer receives bug fixes or critical security updates. ruby-build: using readline from homebrew ruby-build: using gmp from homebrew Installed ruby-2.6.5 to /Users/donbulinux/.anyenv/envs/rbenv/versions/2.6.5 NOTE: to activate this Ruby version as the new default, run: rbenv global 2.6.5