I need to install json via

# gem install json --no-rdoc --no-ri

but I get as result

ERROR:  Error installing json:
    json requires Ruby version ~> 2.0.

I use Ubuntu Trusty (this image) and for some reasons I cannot switch to a more recent distribution like Xenial (16.04). Ubuntu Trusty is a must. The hardware architecture of the Raspberry Pi 2 is not quite helpful because 2rd party repositories like ppa:brightbox/ruby-ng do not support armhf.

I just have Ruby 1.9.3 available.

# ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [arm-linux-eabihf]

# lsb_release -dc
Description:    Ubuntu 14.04.2 LTS
Codename:       trusty

# uname -i

What is the most simple way to install a newer Ruby version?

Update: Solution

These lines worked perfect for me:

# \curl -L https://get.rvm.io | bash
# source /usr/local/rvm/scripts/rvm
# rvm get stable
# rvm install ruby-2.1.5

update-alternatives --install /usr/bin/ruby ruby /usr/local/rvm/rubies/ruby-2.1.5/bin/ruby 400 \
 --slave /usr/bin/rake rake /usr/local/rvm/rubies/ruby-2.1.5/bin/rake \
 --slave /usr/bin/ri ri /usr/local/rvm/rubies/ruby-2.1.5/bin/ri \
 --slave /usr/bin/rdoc rdoc /usr/local/rvm/rubies/ruby-2.1.5/bin/rdoc \
 --slave /usr/bin/gem gem /usr/local/rvm/rubies/ruby-2.1.5/bin/gem \
 --slave /usr/bin/irb irb /usr/local/rvm/rubies/ruby-2.1.5/bin/irb

# ruby --version
ruby 2.1.5p273 (2014-11-13 revision 48405) [armv7l-linux-eabihf]
# gem --version
  • You could always build it from source, is there any reason you cannot do that? – Hatclock Sep 6 '16 at 11:02
  • Compiling from source is always possible in principle but I hoped that there is a more comfortable way. Right now I give RVM a try. A perfect result would be Ruby 2.1 – Neverland Sep 6 '16 at 12:00
  • 1
    I found this – Hatclock Sep 6 '16 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.