Make sure to install optional step 5 in the instructions:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Install ruby-build, which provides the rbenv install command that simplifies the process of installing new Ruby versions.
Answer from Alberto Artasanchez on Stack OverflowMake sure to install optional step 5 in the instructions:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Install ruby-build, which provides the rbenv install command that simplifies the process of installing new Ruby versions.
I had similar problem, and trace the problem to ruby-build. So i updated the homebrew and reinstall the ruby-build
> brew update
> brew reinstall ruby-build
Find the ruby version
> brew ls -v ruby-build | grep 2.1.4
then install intended version ruby again
> rbenv install 2.1.4
Unable to install versions of Ruby with rbenv (build failure)
install ruby 3.2.0 rbenv/1.1.2/libexec/rbenv: No such file or directory
rbenv doesn't find ruby-build plugin if installed in /opt
Using fish, I get "rbenv: no such command `install'"
I had the exact same issue and mine was due to my relative new-ness to Linux... I was trying to use the package manager with sudo apt-get install to set up rbenv and ruby-build. It seemed to work, and I was getting the list of installable Ruby versions when I ran rbenv install -l so I thought I was on the right track. However, when I typed rbenv install 2.2.2 it came back with the usage, just like in your case. But when I actually cloned the git repositories for rbenv and then ruby-build, that was when I got it to work.
I.e. you'll need to follow the steps on https://github.com/sstephenson/rbenv#installation and https://github.com/sstephenson/ruby-build#installation to get it to work. If you get an error about the directory you're copying to not being empty, use rm ~/.rbenv/ -rf to delete whatever is there before you clone again.
Sorry if this doesn't help your situation but this is what I experienced so I thought I would share just in case it helped.
I had exactly the same problem.
I checked ~/.bashrc, and there was no export PATH="$HOME/.rbenv/bin:$PATH".
I ran echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> .bashrc but I had the wrong current directory, so the shell created another .bashrc in the wrong directory.
I put export PATH="$HOME/.rbenv/bin:$PATH" in ~/bashrc and source .bashrc worked!
In the root directory of my Rails project, I have a .ruby-version file with this line inside:
2.2.4@my-project
I can't do anything in terminal, such as run the rails server, because I get this error after any command I run:
rbenv: version `2.2.4@my-project' is not installed (set by /Users/garcia/dev/projects/my-project/.ruby-version)
How can I install this version, with what I'm assuming is a gemset, using rbenv?