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

104,143

Solution 1

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

  • 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

Share:
104,143
Only Bolivian Here
Author by

Only Bolivian Here

Updated on August 18, 2022

Comments

  • Only Bolivian Here
    Only Bolivian Here 6 months

    Here's the console output:

    [email protected]:~$ rvm list
    rvm rubies
       ruby-1.9.3 [ i386 ]
    [email protected]:~$ rvm use 1.9.3
    Using /usr/share/ruby-rvm/gems/ruby-1.9.3
    [email protected]:~$ 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.

    • uday
      uday about 11 years
      rvm use 1.9.3 --default try to make it default.
    • Only Bolivian Here
      Only Bolivian Here about 11 years
      @Dave: Just tried it, same result.
    • Lefsler
      Lefsler about 10 years
      it seems that you didn't changed your profile to include the RVM
  • Max Schmeling
    Max Schmeling almost 11 years
    I'm not sure exactly what the --purge option does on apt-get but it made it work for me. I struggled with this for an hour or two. Thanks
  • Jonathan
    Jonathan almost 11 years
    Purge is supposed to clear configuration settings as well. Standard remove will preserve configuration files.. something you want to avoid with a barge pole in your scenario.
  • mpapis
    mpapis almost 11 years
    actually in this case removing the configuration files is exactly what is needed, this configuration files force wrong settings on RVM, breaking updates and preventing users from using new versions of RVM. The ruby-rvm package provided by ubuntu is old and comes with few bugs that were fixed long time ago.
  • jcollum
    jcollum almost 11 years
    what do you do if env has a lot of rvm stuff in it still? like rvm_dump_environment_flag=0 etc...
  • belacqua
    belacqua almost 11 years
    @mpapis Do you know if this is Ubuntu-specific, or is this broken for Debian and others as well?
  • mpapis
    mpapis almost 11 years
    RVM supports one way of installing, nobody asked us to help them with the package they are building, basically we fixed hundreds of issues since the ubuntu package was released ...
  • citraL
    citraL over 10 years
    It's good, but on my side, there was some output remaining ... which I could fix by erasing the last line of ~/.bashrc ... then, env|grep rvm produced no output anymore ... so I installed RVM via the command above, but it did not work (it seems to work, but running "rvm list" yields "The program RVM is not installed. You can install it by typing sudo apt-get install ruby-rvm" ...
  • mpapis
    mpapis over 10 years
    @citraL please make sure you read through the output of installation of RVM, it should provide you some information about what to do
  • Dan
    Dan over 10 years
    The uninstall methods above didn't work for me. Ended up having to rvn implode followed by new terminal to get a blank env | grep rvm.
  • Jashwant
    Jashwant over 10 years
    +1 , this is the link I get when I try to install rvm in usual way :)
  • Santosh Kumar
    Santosh Kumar over 10 years
    I'm doing curl -L https://get.rvm.io | sudo bash -s stable --ruby but my CURL is saying: Remote file name has no length!
  • Major Productions
    Major Productions over 10 years
    This info should really be on the RVM site
  • mpapis
    mpapis over 10 years
    @KevinM1 rvm.io tells you how to install RVM, and it is not apt-get install rvm many of the users that run this command do not even look on RVM site.
  • prusswan
    prusswan over 10 years
    @mpapis why not just apply to have the rvm package removed from Ubuntu? Its existence doesn't seem to have any beneficial purpose at this point.
  • mpapis
    mpapis over 10 years
    @prusswan that would be awesome, but I do not have time or possibility to do it, if you have any influence on the process I would be grateful for any help with updating / removing the package.
  • Minh Triet
    Minh Triet almost 9 years
    @jcollum try rvm implode. Source: cbednarski.com/articles/installing-ruby
  • Hugo
    Hugo over 8 years
    env | grep rvm was still showing me variables, and rvm implode was failing due to permissions. In my Ubuntu, I had to manually run rm -rf ~/.rvm and manually remove 1 line containing rvm in both ~/.bashrc and ~/.bash_profile
  • Patoshi パトシ
    Patoshi パトシ about 8 years
    running: "sudo apt-get --purge remove ruby-rvm" and I'm getting this error: E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? How do I tell what other process is causing this issue?
  • Vishal
    Vishal over 5 years
    Life saver answer :)
  • Tom Hundt
    Tom Hundt over 2 years
    Apparently the Ubuntu and RVM teams have since cooperated on making a dedicated Ubuntu package, linked to by the official instructions. I used it to install on Ubuntu under WSL and it worked fine, and got me the same version as the curl+bash procedure did on a Red Hat box.