Why does rvm install ruby not work? - ruby

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:

Related

Chruby install Ruby 1.8.7

I'm using chruby for version management and am cloning a project that is unfortunately in Ruby 1.8.7. Is it possible to install Ruby 1.8.7 with chruby? I'm having trouble finding resources for this process.
We did remove all workaround patches and 1.8.x specific code in version 0.4.0. However, if you are installing ruby 1.8.7 on an older system (with older versions of GCC, openssl, etc), it should still compile. 1.8.7 will not compile on newer systems with newer versions of GCC, openssl, etc. If you really need to install 1.8.7, you can try applying RVM's 1.8.7 patches with the --patch option; although running a heavily patched ruby is risky. Also, RedHat and Debian are still maintaining ruby 1.8.7 packages for their enterprise users.
TL;DR
You can't, at least not using ruby-install. Ruby 1.8.7 is end-of-life, and support for it has been dropped by Postmodern's ruby-install tool.
Ruby 1.8.7 is Unsupported
The console error messages may vary depending on your installed libraries and compilers, but an unmodified Ruby 1.8.7 is unlikely to compile on more recent systems. For example, on Ubuntu 13.10:
$ ruby-install ruby 1.8.7
[lots of output elided]
math.c:37:13: error: missing binary operator before token "("
#elif define(ERANGE)
^
make: *** [math.o] Error 1
!!! Compiling ruby 1.8.7 failed!
Why Ruby 1.8.7 is Unsupported
Support for Ruby 1.8.7 was dropped by Postmodern on December 9, 2013. Commit f013ed2 explains:
commit f013ed2476ecce82ea41ff63de413daf2231b82b
Author: Postmodern <postmodern.mod3#gmail.com>
Date: Mon Dec 9 16:09:30 2013 -0800
Drop support for Ruby 1.8.x since it has reached End-of-Life.
* CVE-2013-4164 affects Ruby 1.8.x and there is no official patch.
Enabling users to install and run 1.8.x at this point is irresponsible.
Alternatives
Your alternatives include:
Upgrading to a newer stable version of Ruby such as Ruby 2.1.0.
Using a Ruby version manager such as RVM that, as of this writing, still supports Ruby 1.8.6-p420 and 1.8.7-p374.
Use ruby-build instead of ruby-install. Follow the chruby instructions on using ruby-build in the README to make sure chruby can find the your newly-installed Ruby.
Installing 1.8.7 manually somewhere that chruby can find it, and then using chruby to manage it.
You can use ruby-build which maintains a definition for MRI 1.8.7.
Then install 1.8.7 by doing:
ruby-build 1.8.7-p375 /opt/rubies/1.8.7-p375
The work around is to just install ruby with apt-get
apt-get install ruby
Next tell chruby to use the system ruby.
chruby system
For persistence add it to a ruby version file
echo 'system' > .ruby-version
Unfortunately chruby no longer supports 1.8.7. I have managed to make it working/running by installing 1.8.7 using rvm and linking it into ~/.rubies, like this:
\curl -sSL https://get.rvm.io | bash
rvm install 1.8.7-head
ln -s ~/.rvm/rubies/ruby-1.8.7-head ~/.rubies/ruby-1.8.7
If you are on OS X (10.11, El Capitan), you can install Ruby 1.8.7 using ruby-build in a way that chruby will be able to make use of it:
brew install ruby-build
brew install openssl libyaml libffi
brew install apple-gcc42
brew install openssl098
mkdir -p ~/.rubies
brew link openssl098 --force
ruby-build 1.8.7-p375 ~/.rubies/ruby-1.8.7
brew unlink openssl098
chruby 1.8.7
Reference: http://pawelgoscicki.com/archives/2015/12/installing-ruby-1-8-7-head-for-chruby-using-ruby-build-on-os-x-10-11-el-capitan/

Why would `rvm install ruby-2.1.0` install preview1?

I just tried to install Ruby 2.1, and instead got 2.1 Preview 1. This seems crazy to me. 2.1 is out. Why would RVM assume that when I say rvm install ruby-2.1.0 that I really mean rvm install ruby-2.1.0-preview1? Why would it not match the exact version I specified, instead of one which begins with that substring?
Silly clarification question (and I would post it as a comment if I had enough reputation), but have you updated RVM lately?
rvm get stable (or if you want to live on the edge, rvm get head) would, I expect, update the internal list of released ruby versions.
Make sure you are running the latest version. RVM 1.25.8 (or greater) is working as expected.
$ rvm get latest
Downloading https://github.com/wayneeseguin/rvm/archive/1.25.8.tar.gz
and
$ rvm install 2.1
Searching for binary rubies, this might take some time.
...
ruby-2.1.0 - #downloading ruby-2.1.0, this may take a while depending on your connection...
and
$ rvm use 2.1
Using /Users/weppos/.rvm/gems/ruby-2.1.0
$ ruby --version
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

How to install ruby 1.8.7 on ubuntu 12.04 with rvm?

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

ruby 1.8.7 & ruby 2 without rmv, failed instalation

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.

Which ruby version is installed?

Sounds strange but I cannot tell which ruby version is installed. If I do
rvm rubies
I get
ruby-1.9.2-p180 [ i686 ]
but with
ruby -v
I get
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
When trying to
rvm upgrade 1.8.7-p302 1.9.2-p180
I get an error
ERROR: Ruby 'ruby-1.8.7-p302' is not installed - please install it first.
ERROR: Error migrating gems.
So, which one is it? 1.8.7-p302 or 1.9.2-p180 ???
Please help me out here! Thanks
You get 1.8.7 from the installed version of your system. Use rvm use --default 1.9.2 in order to set the Ruby installed via rvm as default.
RVM basically changes your $PATH variable to point to a different Ruby version than the one installed on your system.
Please also make sure that you have done steps 2 and 3 of the installation guide and confirmed that RVM is correctly set up.
You might have 1.8.7 because you did sudo apt-get install ruby or something like that, and then later ran rvm install 1.9.2. Is that the case?
The answer is both as mentioned by other posters. As a recommendation you should uninstall the ruby packages that come with the system if you choose to manage ruby version using rvm.

Resources