Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Ruby 2.6.6 when rbenv can't find it?

I created a new Rails app (v5.2.4.3) using Ruby 2.7.1 and discovered the blizzard of "keyword parameter" warnings endemic in this release.

rbenv install --list, for some reason, doesn't list Ruby versions beyond 2.4.0. I've manually installed 2.6.6 but am unable to launch it.

This seems like a simple problem. Hints?

like image 911
Brian Piercy Avatar asked Aug 26 '20 00:08

Brian Piercy


People also ask

How do I choose Ruby for Rbenv?

rbenv/shims and detect which Ruby version you want to use. They insert the directory for the selected version at the beginning of your $PATH and then execute the corresponding binary. Because of the simplicity of the shim approach, all you need to use rbenv is ~/. rbenv/shims in your $PATH .

Does Rbenv install Ruby?

Rbenv by itself does not install Ruby implementations at all. You simply give it the path to an already installed Ruby implementation. There are several projects that make installing Ruby implementations easier.

Where is Rbenv installed?

If rbenv is run as the root user then it will be installed to /usr/local/rbenv, otherwise it will be installed to the users ~/. rbenv directory. To make rbenv available in the shell you may need to add the rbenv/shims and rbenv/bin directories to the users PATH.

Do I have Rbenv installed?

You can see if it is using rbenv by typing which ruby and it should print something out with . rbenv/ whatever. If not you need to set rbenv as your current ruby.


1 Answers

You should firstly check the version of plugin 'ruby-build':

cd ~/.rbenv/plugins/ruby-build
git log

If you have not ~/.rbenv/plugins directory, maybe it is too old for the version of your rbenv. First update rbenv:

cd ~/.rbenv
git pull

Then install 'ruby-build' plugin:

git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
like image 186
Run Avatar answered Oct 18 '22 04:10

Run