ASDF is a very interesting version manager with support for several programming languages through plugins.
This post shows a strange behavior I faced when I tried to use an old Ruby version in a Ruby on Rails application.
Installation
I installed Ruby 2.4.3 and set it locally without problems:
$ asdf install ruby 2.4.3
$ asdf local ruby 2.4.3
$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
Error
Everything seemed fine until I try to install the gems for this version:
$ bundle install
asdf: No version set for command bundle
you might want to add one of the following in your .tool-versions file:
ruby 2.6.1
ruby 2.6.3
Checking the .tool-versions
file also displayed the expected version:
$ cat .tool-versions
ruby 2.4.3
Solution
After some research, I found similar issues on Github but suggestions like run asdf reshim ruby
and “restart the terminal” didn’t work.
The actual problem was the message provided by asdf was not clear enough as pointed in this answer.
I wasn’t able to run bundle install
because I didn’t have bundler for this Ruby version.
Installing bundler solved the issue:
$ gem install bundler