Rubyと筋肉とギターとわたし

筋トレが仕事です

【asdf】ruby-build: definition not foundで指定バージョンのrubyをインストールできないとき

どうもてぃ。

記事がなかったのでメモとして。

環境

% cat /etc/lsb-release 
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=19.3
DISTRIB_CODENAME=tricia
DISTRIB_DESCRIPTION="Linux Mint 19.3 Tricia"

asdf install ruby

% asdf install ruby 2.7.3
Downloading ruby-build...
Cloning into '/home/motty/.asdf/plugins/ruby/ruby-build-source'...
remote: Enumerating objects: 11536, done.
remote: Counting objects: 100% (229/229), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 11536 (delta 174), reused 151 (delta 105), pack-reused 11307
Receiving objects: 100% (11536/11536), 2.44 MiB | 12.60 MiB/s, done.
Resolving deltas: 100% (7641/7641), done.
Note: checking out 'v20201005'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 29d1749 bump version to 20201005
ruby-build: definition not found: 2.7.3

むむ!?

ローカルにあるインストール候補を確認してみる。

% asdf list-all ruby | grep 2.7
1.8.6-p287
2.0.0-p247
2.2.7
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
2.7.1
2.7.2
jruby-9.2.7.0
rbx-2.2.7
rbx-2.7
rbx-2.71828182

2.7.3ないな…

asdf rubyをアプデ

% asdf plugin-update ruby
Updating ruby...
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 30 (delta 10), reused 14 (delta 10), pack-reused 11
Unpacking objects: 100% (30/30), done.
From https://github.com/asdf-vm/asdf-ruby
   101e86a..ab15a18  master     -> master
   101e86a..ab15a18  master     -> origin/master
Already on 'master'
Your branch is up to date with 'origin/master'.

これでasdfをアプデ出来たっぽい。

確認すると…

% asdf list-all ruby | grep 2.7
1.8.6-p287
2.0.0-p247
2.2.7
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
2.7.1
2.7.2
2.7.3
jruby-9.2.7.0
rbx-2.2.7
rbx-2.7
rbx-2.71828182

来ました。

終わり

asdfは定期的にasdf reshimだったりasdf plugin-updateだったりやってあげたほうがよさげですね。