Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v

RubyUbuntuRvm

Ruby Problem Overview


Here's the console output:

sergio@sergio-VirtualBox:~$ rvm list

rvm rubies

   ruby-1.9.3 [ i386 ]

sergio@sergio-VirtualBox:~$ rvm use 1.9.3
Using /usr/share/ruby-rvm/gems/ruby-1.9.3

sergio@sergio-VirtualBox:~$ ruby -v
The program 'ruby' can be found in the following packages:
 * ruby1.8
 * ruby1.9.1
Try: sudo apt-get install <selected package>

So what's going on? Do I need to reboot my machine? Or should it work right off the bat? I'm using Ubuntu 11.10, any help is appreciated.

Ruby Solutions


Solution 1 - Ruby

You have broken version of RVM. Ubuntu does something to RVM that produces lots of errors, the only safe way of fixing for now is to:

sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh

open new terminal and validate environment is clean from old RVM settings (should be no output):

env | grep rvm

if there was output, try to open new terminal, if it does not help then restart your computer.

install RVM:

\curl -L https://get.rvm.io | 
  bash -s stable --ruby --autolibs=enable --auto-dotfiles

If you find you need some hand-holding, take a look at Installing Ruby on Ubuntu 12.04, which gives a bit more explanation.

Solution 2 - Ruby

  • Open Terminal.
  • Go to Edit -> Profile Preferences.
  • Select the Title & command Tab in the window opened.
  • Mark the checkbox Run command as login shell.
  • close the window and restart the Terminal.

Check this Official Linkenter image description here

Solution 3 - Ruby

I ran into a similar issue today - my ruby version didn't match my rvm installs.

> ruby -v
ruby 2.0.0p481

> rvm list
rvm rubies
   ruby-2.1.2 [ x86_64 ]
=* ruby-2.2.1 [ x86_64 ]
   ruby-2.2.3 [ x86_64 ]

Also, rvm current failed.

> rvm current
Warning! PATH is not properly set up, '/Users/randallreed/.rvm/gems/ruby-2.2.1/bin' is not at first place...

The error message recommended this useful command, which resolved the issue for me:

> rvm get stable --auto-dotfiles

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionOnly Bolivian HereView Question on Stackoverflow
Solution 1 - RubympapisView Answer on Stackoverflow
Solution 2 - RubydeadbugView Answer on Stackoverflow
Solution 3 - RubyrandallreedjrView Answer on Stackoverflow