事象
rbenv install 2.6.3 が BUILD FAILED してしまう。。
$ rbenv install 2.6.3
rbenv: /Users/user/.rbenv/versions/2.6.3 already exists
continue with installation? (y/N) y
Downloading openssl-1.1.1i.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
Installing openssl-1.1.1i...
Installed openssl-1.1.1i to /Users/user/.rbenv/versions/2.6.3
Downloading ruby-2.6.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.bz2
Installing ruby-2.6.3...
ruby-build: using readline from homebrew
BUILD FAILED (macOS 11.1 using ruby-build 20210119)
Inspect or clean up the working tree at /var/folders/81/y_mntqpn7651ft78m781s9nw0000gn/T/ruby-build.20210405230655.5546.REHmaD
Results logged to /var/folders/81/y_mntqpn7651ft78m781s9nw0000gn/T/ruby-build.20210405230655.5546.log
Last 10 log lines:
from ./tool/rbinstall.rb:526:in `install'
from ./tool/rbinstall.rb:556:in `block (2 levels) in <main>'
from ./tool/rbinstall.rb:264:in `block in install_recursive'
from ./tool/rbinstall.rb:258:in `each'
from ./tool/rbinstall.rb:258:in `install_recursive'
from ./tool/rbinstall.rb:555:in `block in <main>'
from ./tool/rbinstall.rb:933:in `block in <main>'
from ./tool/rbinstall.rb:930:in `each'
from ./tool/rbinstall.rb:930:in `<main>'
make: *** [do-install-all] Error 1
解決法
ググるといろいろ出てきますが何事もとりあえずログを見てから、、
# ログを見てみる
$ cat /var/folders/81/y_mntqpn7651ft78m781s9nw0000gn/T/ruby-build.20210405230655.5546.log
...
installing binary commands: /Users/user/.rbenv/versions/2.6.3/bin
installing base libraries: /Users/user/.rbenv/versions/2.6.3/lib
installing arch files: /Users/user/.rbenv/versions/2.6.3/lib/ruby/2.6.0/x86_64-darwin20
installing pkgconfig data: /Users/user/.rbenv/versions/2.6.3/lib/pkgconfig
installing command scripts: /Users/user/.rbenv/versions/2.6.3/bin
./tool/rbinstall.rb:279:in `chmod`: Operation not permitted @ apply2files - /Users/user/.rbenv/versions/2.6.3/bin/bundle (Errno::EPERM)
# Permission Errorみたい
# sudo すればよさそう
$ sudo rbenv install 2.6.3
Password:
...
Installed ruby-2.6.3 to /Users/user/.rbenv/versions/2.6.3