3

I am trying to install RubyInline on some Ubuntu server:

sudo gem1.9.1 install RubyInline
ERROR:  Error installing RubyInline:
        ZenTest requires RubyGems version ~> 1.8


sudo ruby --version
ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux]

What is the cause of this error? I am confused by the 1.8 reference. This should all be Ruby1.9.1. How to resolve this?

maasha
  • 1,926
  • 3
  • 25
  • 45

4 Answers4

6

The ~> 1.8 means "Any version of RubyGems, as long as it's 1.8 or higher, but smaller than 2.0". So 1.8.0, 1.8.11, 1.8.100 or 1.9 all match, but the version you have does not.

The 1.9.1 in the gem command does not mean RubyGems is at version 1.9.1, but that it's the version that came with the Ruby 1.9.1 install. To find out what version of RubyGems you have, run gem1.9.1 --version.

To resolve this, you can either upgrade Rubygems, or install a version of ZenTest that is compatible with the version of Rubygems you have by running sudo gem1.9.1 install ZenTest --version "< 4.6" (assuming that ZenTest 4.5 is compatible with your RubyGems)

Markus
  • 526
  • 3
  • 5
  • This is happening when trying to run an old Rails 3 project. I guess you have to downgrade rubygems http://stackoverflow.com/questions/523993/how-do-you-downgrade-rubygems – Donato Apr 14 '15 at 03:32
4

The short answer is run

gem update --system

For the long answer, see cypher's post above.

Eugene
  • 4,829
  • 1
  • 24
  • 49
  • Hm, this is disabled on Debian type systems. – maasha Nov 18 '11 at 15:59
  • 2
    Ahh yes, I forgot about that. This is where RVM really starts to shine. I try to avoid using distribution specific packages wherever possible in favor of using RVM. – Eugene Nov 18 '11 at 16:17
  • If you get an error, "You don't have write permissions into the /Library/Ruby/Gems/1.8 directory." like on my Mac OS X you'll need to run this as root, so the command would be `sudo gem update --system` – SammyK Aug 03 '12 at 19:13
  • @SammyK Better yet, install RVM. – Marnen Laibow-Koser Dec 03 '13 at 19:39
1

From the Bundler Documentation:

The specifier ~> has a special meaning, best shown by example. ~> 2.0.3 is identical to >= 2.0.3 and < 2.1.

So the "~> 1.8" reference means any version of RubyGems < 1.9.

One possible solution would be to write your extension without RubyInline:
how-to-create-a-ruby-extension-in-c-in-under-5-minutes

Sean Vikoren
  • 1,084
  • 1
  • 13
  • 24
  • "So the "~> 1.8" reference means any version of Ruby < 1.9." *Rubygems*, not *Ruby*. Yes, it's confusing having two similarly named things with similar version numbers! – Andrew Grimm Jan 27 '12 at 02:36
0
bundle update

helped for me, it updated ZenTest from 4.6.2 to 4.11.1

randomcontrol
  • 1,996
  • 1
  • 15
  • 11