rbenv: ruby: command not found after install

Created on 29 May 2013  路  15Comments  路  Source: rbenv/rbenv

after install and config rbenv following rbenv documentation i got this error:

$ ruby -v
rbenv: ruby: command not found

The `ruby' command exists in these Ruby versions:
1.8.7-p249
1.9.3-dev
1.9.3-p125

why? i already removed RVM installation - the single thing that I found at foruns or similar issues.

unconfirmed

Most helpful comment

@ITPROz make sure you add the rbenv init in ~/.profile (I had the same error on Ubuntu 13.04)

export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
  eval "$(rbenv init -)"
fi

All 15 comments

You probably haven't select any particular version and it tries falling back to the system Ruby which it doesn't find.

Do rbenv global 1.9.3-p125 and try again. If that doesn't help, post us the output of rbenv versions and which -a ruby

thanks for your reply.

when I do rbenv global 1.9.3-p125 i got the same error.. then I tried:

$ rbenv versions
system
1.8.7-p249
1.9.3-dev

  • 1.9.3-p0 (set by /Users/fagnermoura/Developer/freelancers/testapp/.ruby-version)
    1.9.3-p125
    1.9.3-rc1

$ which -a ruby
/Users/fagnermoura/.rbenv/shims/ruby
/usr/local/bin/ruby

ops. i solved this problem, but i believe that still exists something wrong

this happens when i use a version locally (.ruby-version) that is different than global or when i try to use rails, gem or ruby command on folder that not have any .ruby-version file

Try updating rbenv to the latest version. Please describe your problem in more detail. Which exact combination of circumstance leads to the error?

You seem to be running OS X. How come your output for which -a ruby doesn't include /usr/bin/ruby? Because OS X ships with a system ruby in that location. (Probably not causing your problem, but caught my eye nevertheless.)

As with all troubleshooting of rbenv, please post your PATH along with other info when debugging.

It's happening something similar to me, i just installed rbenv and can't use install. Any other command seems to work.

rbenv: no such command `install'

I'm using Ubuntu 13.04.

Likewise: post more info about the problem. Take a look at the wiki Troubleshooting section and the doctor script.

Yes mislav. Im running OSX (mountain lion).

$ echo $PATH
/Users/fagnermoura/.rbenv/bin:/Users/fagnermoura/.rbenv/shims:/Users/fagnermoura/Developer/scala/sbt/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

xcode-tools can use this ruby version (1.8 that ships with OSX), i don't know.. I never tried uninstall it, cuz I aways use rvm or rbenv.

In the ~/Developer/freelancers/testapp project you configured the "1.9.3-p0" version. However that version seems to be causing the "ruby: command not found" error. rbenv says that on your system, versions other than that have the ruby command. So you should check ~/.rbenv/versions/1.9.3-p0/bin to see whether the ruby executable is indeed there.

And about your system install of Ruby:

xcode-tools can use this ruby version (1.8 that ships with OSX), i don't know.. I never tried uninstall it, cuz I aways use rvm or rbenv.

Sure, OS X ships with Ruby 1.8, you don't have to use it and you shouldn't uninstall it. However, the system Ruby should be in /usr/bin/ruby on OS X, not in /usr/local/bin/ruby. This is what I was asking you about. If you have /usr/local/bin/ruby, that one is most likely manually installed either by you, Homebrew, or another installer. But it seems that you _don't_ have /usr/bin/ruby, which is super-weird if you said you never uninstalled it.

@ITPROz make sure you add the rbenv init in ~/.profile (I had the same error on Ubuntu 13.04)

export RBENV_ROOT="${HOME}/.rbenv"
if [ -d "${RBENV_ROOT}" ]; then
  export PATH="${RBENV_ROOT}/bin:${PATH}"
  eval "$(rbenv init -)"
fi

Closing since this seems to be a system issue, not a bug in rbenv. I feel like I gave enough advice for you to debug your system.

Oops! When I used "rbenv global 2.0.0-p247", everything goes well!!!

@ysyfff yeap, i put rbenv global 2.1.1 and everything goes fine

Try rbenv rehash after rbenv install 1.9.3-dev @seufagner

I installed rbenv to ubuntu 16.04 with below guide
but when I run this command, got an error message.
rails -v
-bash: /user/bin/ruby: No such file or directory.
How can I solve it?
Thanks

Oops! When I used "rbenv global 2.0.0-p247", everything goes well!!!

This worked for me too! rbenv global <version_number>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slayer picture slayer  路  4Comments

sandys picture sandys  路  4Comments

ponamute picture ponamute  路  4Comments

codfather picture codfather  路  3Comments

MichalMichalak picture MichalMichalak  路  3Comments