I installed ruby 2.0 (from sources) in a centos that already had ruby 1.8.7.
I did not know that there was a previous installation.
I also noticed that had installed RVM. Now it doesn't work.
The RVM output
$ /usr/local/rvm/bin/rvm list
$ rvm rubies
No rvm rubies installed yet. Try 'rvm help install'.
From what I understand, RVM does not know there is already a installed version of Ruby.
Is possible uninstall all versions and reinstall ruby with RVM?
RVM allows "mounting" system rubies:
rvm mount /path/to/ruby
Or assuming all rubies are added to PATH
rvm automount
RVM will find any ruby binary available on PATH and will add it to rvm list
RVM does not care for rubies installed at the system level. It installs rubies to RVMs own folder inside of the users home directory. You should just install the desired ruby version using RVM. Since the RVM rubies should have precedence over the system-installed ruby, that should work out just fine.
Related
I'm working with a legacy rails system. I need a copy of ruby 1.8.7
I've just been given a new computer at work (finally) and it has ubuntu 12.04
Unfortunately I've just discovered that the rvm-rubies available for my system do not contain 1.8.7 (see list below)
How can I install ruby 1.8.7?
Is there another source that I can point to that will work?
Please note: I did not use apt-get to install rvm, that is not the problem
This is the list of available rubies:
# Rubies available for 'ubuntu/12.04/x86_64':
ruby-1.9.3-p194
ruby-1.9.3-p286
ruby-1.9.3-p327
ruby-1.9.3-p362
ruby-1.9.3-p374
ruby-1.9.3-p392
ruby-1.9.3-p429
ruby-1.9.3-p448
ruby-2.0.0-p0
ruby-2.0.0-p195
ruby-2.0.0-p247
Edit:
Just so you know, here's the output of some of the simpler rvm commands:
triton:[~]% rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
And rvm install gives this message (which make sit clear there is no version of 1.8.7 in the standard repository).
triton:[~]% rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/x86_64/ruby-1.8.7-p374.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
You requested building with 'gcc-4.4' but it is not in your path.
From the documentation:
To install a specific tagged version of ruby from the repository we
specify -t(tag name).
It then goes on to talk about branches...
Repository Branches (MRI)
To install a specific branch version of ruby from the repository we specify --branch (branch name). Named rubies can help avoid clashes.
$ rvm install ruby-head -n zombie --branch ruby_1_8 && rvm ruby-head-zombie
$ ruby -v
ruby 1.8.8dev (2012-05-21) [i386-darwin10.8.0]
$ rvm install ruby-head -n newborn && rvm ruby-head-newborn
$ ruby -v
ruby 2.0.0dev (2012-06-03 trunk 35876) [x86_64-darwin10.8.0]
You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/
You have access to much more than what is shown.
ruby_1_3/
ruby_1_4/
ruby_1_6/
ruby_1_8/
ruby_1_8_5/
ruby_1_8_6/
ruby_1_8_7/
ruby_1_9_1/
ruby_1_9_2/
ruby_1_9_3/
ruby_2_0_0/
More hints on the RVM official website
Also, for additional help, the IRC Chat room on freenode.net is awesome!
what you have presented is output from rvm list remote - which list binary (already compiled) rubies for your system, to see more possible choices of version run rvm list which will include 1.8.7:
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head
and it continues with number of other ruby distributions.
If not sure you can always just run:
rvm install 1.8.7
RVM does all kind of detections and will most likely know what to do with specified version.
For future reference: I figured it out.
The important clue was in the last line of the result for rvm install:
You requested building with 'gcc-4.4' but it is not in your path.
I had gcc version 4.6 but my .zshrc (copied from my previous computer) was pointing at this older version.
Because of this, rvm thought I didn't have a c-compiler. Which means that rvm wasn't able to install any rubies from source - only pre-compiled rubies - which means it was restricted to only those already pre-compiled for my platform (ie 64-bit ubuntu 12.04)
When I fixed the gcc line in my .zshrc - rvm was able to figure out how to install+compile source-code rubies - including v1.8.7
I am using Ubuntu 12.04 and I have system default ruby 1.8 and 1.9.1 and 1.9.3. The problem is that I do manage to switch to 1.9.3 but not the gems for the 1.9.3 and by default system is using the 1.9.1 gems. This causes a lot of errors while using the rails and other ruby libs which are dependent on the 1.9.3.
I tried to use
sudo update-alternatives --config ruby
sudo update-alternatives --config gems
and it doesn't offered me to choose 1.9.3 gems but only managed to switch the ruby interpreter. I tried rbenv and rvm but no use. While using the rails and the shoes, I get plenty of errors related to the gems of 1.9.1.
Also when I use the switch with rvm, it asks me to install ruby 1.9.3 which is already installed but doesn't show up for rvm and rbenv.
Is there something wrong with ruby on this system?
you might be confusing compatibility level with the real ruby version, all ruby 1.9.x will have 1.9.1 in their paths - it is the intended behavior.
using rvm you can mount system installed rubies:
rvm automount
OR:
rvm mount /path/to/bin/ruby193 -n system193
but those system rubies might have some extra configuration that can make them not to work well with RVM, you might be better with just installing fresh ruby:
rvm get head
rvm requirements # make sure to read it
rvm use 1.9.3 --install
if you care for performance and value your time you an use falcon patch and compilation on more cores:
rvm install 1.9.3 --patch falcon -j 3
rvm use 1.9.3
It is said on the Rails 3.2.9 blog that Ruby 1.9.3-p327 is recommended to be installed. But
rvm install ruby-1.9.3-p327
actually gives an error, and the log says:
There is no checksum for
'http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.bz2' or
'ruby-1.9.3-p327.tar.bz2', it's not possible to validate it. If you
wish to continue with unverified download add '--verify-downloads 1'
after the command.
But I checked http://ftp.ruby-lang.org/pub/ruby/1.9/ and the ruby-1.9.3-p286 has the same files as the p327. So where is the checksum located? Is it inside of the .bz2 file? So how should we install p327, is it just by
rvm install 1.9.3-p327 --verify-downloads 1
and is there security concerns, or are there other methods to install it safely?
First thing, make sure that your rvm version knows about this version by running rvm list known
On my machine, when I ran it the first time I got the following output for known MRI Rubies:
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7-p370
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2-p318
[ruby-]1.9.2[-p320]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-[p286]
[ruby-]1.9.3-head
ruby-head
So my version of rvm only knew about 1.9.3-[p286] as the most recent version 1.9.3 version.
I got the latest version of rvm with the following command:
$ rvm get stable
After that, the list of known MRI rubies was as follows:
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7-p370
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2-p180
[ruby-]1.9.2-p290
[ruby-]1.9.2-p318
[ruby-]1.9.2[-p320]
[ruby-]1.9.2-head
[ruby-]1.9.3-preview1
[ruby-]1.9.3-rc1
[ruby-]1.9.3-p0
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-p286
[ruby-]1.9.3-[p327]
[ruby-]1.9.3-head
[ruby-]2.0.0-preview1
ruby-head
A related thread on the rvm googlegroups discussion forum
In ubuntu 12.04, I use the cmd as follows, the newest version "-p327" will automatically detected and installed:
rvm install 1.9.3
The guide Installing Rails on Ubuntu 12.04 with RVM support may helps:
I'm on Linux Ubuntu 12.04, and I first installed Ruby 1.9.2.
After I tried installing rvm to use Octopress, ruby --version in bash results in ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
How can I use RVM with ruby 1.9.2?
I don't really understand what RVM is all about...
The 1.9.2 version you installed first is not accessible from rvm.
While working with rvm, only the list of rubies installed through rvm is served. The previously installed versions of ruby - while still present in the filesystem - are not included.
With the steps you have done so far, you have a 1.9.2 version installed in one location, and a 1.8.7 version installed as part of rvm.
Install 1.9,2 version by running the rvm install 1.9.2 command. After that, when you run the rvm list command, you should see an output similar to the following:
$ rvm list
rvm rubies
ruby-1.8.7-p358 [ i686 ]
=* ruby-1.9.2-p320 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You can switch between different versions of ruby managed by rvm with the rvm use 1.8.7 / rvm use 1.9.2 commands.
Here's a short blogpost with a good intro to rvm: Get started right with RVM
RVM is a version manager which enables you to decide which of multiple installed Ruby versions you want to use in your current shell session. RVM does this by providing a shell function named rvm which can be used to switch between versions in the current session. This changes environment variables, especially the GEM_HOME and PATH, to match the currently selected Ruby installation.
Every installed Ruby version can be selected by a specific identifier string. If you had a system-wide Ruby installation already before you installed RVM, that one should be referenced by the string system. The newly installed version in your case should be called 1.9.2.
To make RVM work as intended, it is necessary to load the rvm shell function into your shell. How to do this is described in the RVM Installation Documentation in section 2 - "Load RVM into your shell sessions as a function".
You can see if the shell function is correctly loaded when the command type rvm | head -n1 responds with:
rvm is a shell function
If not correctly loaded it will tell you something like this:
rvm is /home/someone/.rvm/bin/rvm
If you finally have it working you can switch your active Ruby version with commands like rvm 1.9.2 or rvm system. You can get a list of all Ruby versions and their identifier strings recognized by RVM by the command rvm list.
You can also specify which Ruby version shall be enabled in all new shell sessions from the beginning by issuing the following command once:
rvm --default 1.9.2
Perhaps you have not yet switched to the ruby version with:
rvm use 1.9.2 (assuming you did rvm install 1.9.2)
for a more general explanation I gave an answer here which might help.
I was having a problem with RVM, so I uninstalled and re-installed it.
The truth is I actually tried rbenv, but that didn't work out for me so I am trying to get rvm up and running again - without having to install duplicate versions of Ruby.
I have at least 1 existing version of Ruby installed:
ruby --version
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
But when I do rvm list I get a blank list:
bash-3.2$ rvm list
rvm rubies
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
# * - default
So my question has two parts:
How do I see all the versions of Ruby on my system (given that rvm is not showing me any)?
How do I associate the new RVM install with the existing versions of Ruby?
Or am I better off removing all existing versions of Ruby and re-installing everything? That seems like a pain in the ass though.
You can add an existing ruby to rvm using:
rvm mount /path/to/ruby
or:
rvm automount
but be careful as ruby installed in system might have hardcoded paths for gems - so gemsets would not work with it.
There is also new way of adding binary rubies (already compiled), for list of available builds for your platform run:
rvm list remote
and you can install those rubies using:
rvm mount -r 1.9.3
This might be default way of installing ruby to avoid compilation in next stable release of RVM - but it will work only for ruby 1.9.3+.
You don't want to associate RVM with an existing Ruby, you just want to install a new Ruby.
You don't want to remove the system Ruby, either; OS X depends on it.
Install a new 1.8.7 under rvm, this way you can associate your own gemsets with it. Let OS X manage the default system Ruby, you just ignore it and use your own, managed solely by rvm.
(If you decide to go the rvm route.)