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.
6 Answers
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.

- 81,402
- 15
- 141
- 199
-
It appears you mistyped the original ruby-install command (forgot a space between the ruby and version): ruby-install ruby 1.8.7 – postmodern Feb 23 '14 at 01:46
-
@Postmodern Thanks. I fixed the ruby-build argument syntax, and updated that section of my answer with a better example of the kinds of compiler errors one might expect. – Todd A. Jacobs Feb 23 '14 at 02:01
-
I just tested ruby-build on Fedora 19, and it also fails to compile ruby 1.8.7 due to the OpenSSL version. Compiling by hand is also not an option, as that's no different from what ruby-build/ruby-install do. – postmodern Feb 23 '14 at 05:11
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.

- 454
- 3
- 3
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

- 5,187
- 3
- 27
- 33
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

- 2,513
- 1
- 12
- 8
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

- 9,066
- 5
- 70
- 81
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

- 9,066
- 5
- 70
- 81