0

I installed rbenv and it seems and copied 2 versions of ruby to ~/.rbenv/versions, it shows them both correctly.

When I run rbenv global 1.8.7-p72
It says ok and also points to it. However when I run--

ruby --version

I get ruby not found. Basically, the ruby executable is not found in the path. Can anyone help me with this problem?

My .bash_profile is
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

rbenv versions outputs --
1.8.7-p72
*1.9.3-p448 ( set by /home/user/.rbenv/version)

Also my ~/.rbenv/shims directory doesn't have a ruby executable. It has erb, gem,irb , rake, rdoc , ri and testrb. Could this be the issue?

I'm sorry I'm completely clueless

Aman Gupta
  • 557
  • 1
  • 8
  • 23

2 Answers2

1
  • Did you execute all the step in the installation instructions https://github.com/sstephenson/rbenv? I.e. did you add the required snippets to your shell startup (.bash_profile) and so forth?

    If you followed the instructions, could you provide the output of rbenv versions and which -a ruby for a start?

EDIT:

  • rbenv rehash seems to be what generates the shims. This must be executed every time you install a new ruby version. How did you install the rubies? With ruby-build, as recommended in the installation instructions?
Community
  • 1
  • 1
koffeinfrei
  • 1,985
  • 13
  • 19
  • nope, I did not install using ruby-build. I did it by adding the compiled version to ~/.rbenv/versions which according to the website is also a valid way to do it – Aman Gupta Sep 05 '13 at 16:12
0

When I encountered this error, all I had to do was to make sure that $PATH had shims prior to system version of ruby like so: ~/.rbenv/shims:/usr/local/bin:/usr/bin:/bin

babalu
  • 602
  • 5
  • 15