173

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.

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257

3 Answers3

550

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.

Matthias Michael Engh
  • 1,159
  • 2
  • 10
  • 25
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • 5
    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 – Max Schmeling Feb 29 '12 at 04:12
  • 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. – Jonathan Apr 18 '12 at 00:23
  • 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. – mpapis Apr 18 '12 at 10:44
  • 4
    what do you do if env has a lot of rvm stuff in it still? like `rvm_dump_environment_flag=0` etc... – jcollum Apr 22 '12 at 21:28
  • @mpapis Do you know if this is Ubuntu-specific, or is this broken for Debian and others as well? – belacqua May 13 '12 at 00:22
  • 5
    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 ... – mpapis May 13 '12 at 02:57
  • 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" ... – citraL Jul 02 '12 at 14:01
  • @citraL please make sure you read through the output of installation of RVM, it should provide you some information about what to do – mpapis Jul 04 '12 at 01:01
  • 1
    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`. – Dan Aug 01 '12 at 11:03
  • 26
    +1 , this is the link I get when I try to install rvm in usual way :) – Jashwant Sep 16 '12 at 19:36
  • 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!` – Santosh Kumar Sep 24 '12 at 18:06
  • This info should really be on the RVM site – Major Productions Oct 14 '12 at 21:08
  • 4
    @KevinM1 https://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. – mpapis Oct 15 '12 at 02:08
  • 1
    @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. – prusswan Oct 24 '12 at 18:38
  • @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. – mpapis Oct 24 '12 at 19:43
  • @jcollum try `rvm implode`. Source: http://cbednarski.com/articles/installing-ruby/ – Minh Triet Mar 24 '14 at 16:06
  • `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** – Hugo Sep 03 '14 at 06:59
  • 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? – Patoshi パトシ Jan 26 '15 at 19:18
  • **Apparently the Ubuntu and RVM teams have since cooperated on making a [dedicated Ubuntu package](https://github.com/rvm/ubuntu_rvm)**, linked to by [the official instructions](https://rvm.io/rvm/install). 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. – Tom Hundt Aug 14 '20 at 17:58
9
  • 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

deadbug
  • 434
  • 5
  • 19
0

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
randallreedjr
  • 340
  • 3
  • 7