やりたいこと
rbenv install 2.7.2を実行して
Ruby2.7.2をインストールしたい
環境
Ruby 2.6.5
M1チップ搭載MacOS
前提条件
Homebrewインストール済
rbenvインストール済
発生したエラー
Downloading openssl-1.1.1i.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
Installing openssl-1.1.1i...
Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2
Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.4 using ruby-build 20210119)
Inspect or clean up the working tree at /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.ESLM2k
Results logged to /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.log
Last 10 log lines:
compiling date_parse.c
installing default console libraries
compiling date_strftime.c
compiling date_strptime.c
linking shared-object objspace.bundle
linking shared-object io/nonblock.bundle
linking shared-object io/console.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2
解決方法
以下のコマンドで解決しました。
arch -arm64 rbenv install 2.7.2
成功時のログ
Downloading openssl-1.1.1i.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
Installing openssl-1.1.1i...
Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2
Downloading ruby-2.7.2.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
Installing ruby-2.7.2...
ruby-build: using readline from homebrew
Installed ruby-2.7.2 to /Users/yunyun_jp/.rbenv/versions/2.7.2