Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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...

like image 740
Danny Cox Avatar asked Nov 11 '14 19:11

Danny Cox


People also ask

Does Rbenv install Ruby?

Ruby on Rails is one of the most popular application stacks for developers looking to create sites and web apps. The Ruby programming language, combined with the Rails development framework, allows you to build and deploy scalable apps quickly. You can install Ruby and Rails with the command line tool rbenv.

How do I know if Rbenv is 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. You can do that like rbenv global 2.1.

What is Rbenv in Ruby?

rbenv is included in all installations of Bitnami Ruby stack that use system packages. It is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments. Every installed Ruby interpreter using rbenv is isolated in its own directory with its libraries and gems.


2 Answers

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.

like image 163
Alberto Artasanchez Avatar answered Sep 29 '22 19:09

Alberto Artasanchez


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 
like image 40
Muntasir R Avatar answered Sep 29 '22 19:09

Muntasir R