Hello,
I recently installed a fresh installation of Ubuntu, and used this guide to install rbenv: https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-18-04
Ever since, irb command is not working.
It appeared to be installed:
maayan@maayan:~/apps/makerspro$ which irb
/home/maayan/.rbenv/shims/irb
maayan@maayan:~/apps/makerspro$ rbenv which irb
/home/maayan/.rbenv/versions/2.6.3/bin/irb
but this is the output I get:
maayan@maayan:~/apps/makerspro$ irb
Traceback (most recent call last):
1: from /home/maayan/.rbenv/versions/2.6.3/bin/irb:23:in <main>'
/home/maayan/.rbenv/versions/2.6.3/bin/irb:23:inload': cannot load such file -- /home/maayan/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb (LoadError)
Does the file referenced in the error message exist?
$ file ~/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb
/Users/mislav/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb: Ruby script text executable, ASCII text
If not, it sounds like a broken Ruby 2.6.3 installation. I'm not sure how that could have happened during rbenv install 2.6.3, unless it exited with an error. Did you notice anything off during the installation?
In any case, this is not a bug with rbenv. If anything, it's a bug with Ruby's own installer and its default gems. Try this to fix it:
RBENV_VERSION=2.6.3 gem install irb
Thank you so much, Mislav!
I didn't notice anything off in the installation, but installing it manually with the command your provided did the trick.
My apologies :)
Hi, I tried the solution above and it gave the following error:

Hi, I tried the solution above and it gave the following error:
So did I. For me the following isntructions solved the problem:
rbenv uninstall 2.7.0
rbenv install 2.7.0
I am running Ubuntu 18.04.
Most helpful comment
Does the file referenced in the error message exist?
If not, it sounds like a broken Ruby 2.6.3 installation. I'm not sure how that could have happened during
rbenv install 2.6.3, unless it exited with an error. Did you notice anything off during the installation?In any case, this is not a bug with rbenv. If anything, it's a bug with Ruby's own installer and its default gems. Try this to fix it: