rbenv: no such command "install" even though ruby-build is installed

Danny Cox picture Danny Cox · Nov 11, 2014 · Viewed 11.1k times · Source

I'm trying to get ruby 2.1.4 installed via rbenv for a client project.

Though previously I've been able to install ruby versions through rbenv, after upgrading to Yosemite, I keep getting the following error:

rbenv: no such command 'install'

After digging around, I saw lots of tips about how "install" comes from the ruby-build plugin, which is installed via homebrew:

which ruby-build
/usr/local/bin/ruby-build

I installed rbenv via Homebrew, but when I try use which rbenv, I get:

rbenv () {
typeset command
command="$1" 
if [ "$#" -gt 0 ]
then
    shift
fi
case "$command" in
    (rehash|shell) eval `rbenv "sh-$command" "$@"` ;;
    (*) command rbenv "$command" "$@" ;;
esac
}

I have run brew update and brew upgrade rbenv ruby-builder, and it tells me everything is up to date.

Below is my full $PATH:

zsh: no such file or directory: /usr/local/var/rbenv/shims:/usr/local/var/rbenv/shims:/usr/local/bin:/usr/local/sbin:/Users/dannycox/.rbenv/shims:/Users/dannycox/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/Users/dannycox/.rbenv/shims:/Users/dannycox/.rbenv/bin

UPDATE: Found another answer with a little deeper digging on github that showed signs of promise, but failed to solve the issue with rbenv. https://github.com/sstephenson/rbenv/issues/610#issuecomment-56240018

I believe 2.1.4 is now installed on my machine, but it installed here: Successfully installed ruby 2.1.4 into /Users/dannycox/.rubies/ruby-2.1.4

As a result, my bundler won't work with the new ruby 2.0 version and I get the following error when I try to gem install bundle:

Fetching: bundler-1.7.6.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory

Still need help to identify why ruby-build isn't playing nice with rbenv...

Answer

Alberto Artasanchez picture Alberto Artasanchez · Jun 8, 2015

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.