Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rbenv: ruby: command not found after install #399

Closed
seufagner opened this issue May 29, 2013 · 16 comments
Closed

rbenv: ruby: command not found after install #399

seufagner opened this issue May 29, 2013 · 16 comments

Comments

@seufagner
Copy link

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.

@mislav
Copy link
Member

mislav commented May 29, 2013

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

@seufagner
Copy link
Author

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

@seufagner
Copy link
Author

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

@mislav
Copy link
Member

mislav commented May 31, 2013

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.

@ITPROz
Copy link

ITPROz commented Jun 1, 2013

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.

@mislav
Copy link
Member

mislav commented Jun 2, 2013

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

@seufagner
Copy link
Author

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.

@mislav
Copy link
Member

mislav commented Jun 5, 2013

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.

@defvol
Copy link

defvol commented Aug 30, 2013

@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

@mislav
Copy link
Member

mislav commented Sep 28, 2013

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.

@mislav mislav closed this as completed Sep 28, 2013
@ysyfff
Copy link

ysyfff commented Dec 3, 2013

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

@reydi
Copy link

reydi commented Apr 27, 2014

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

@bebekim
Copy link

bebekim commented Jul 2, 2016

Try rbenv rehash after rbenv install 1.9.3-dev @seufagner

@snail9367
Copy link

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

@kmanojkumar
Copy link

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

This worked for me too! rbenv global <version_number>

@biendltb
Copy link

rbenv global <version_number> not works for me but rbenv local <version_number> does

@rbenv rbenv locked as resolved and limited conversation to collaborators Dec 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants