views:

314

answers:

2

I've noticed at least the following oddities around rubygems on Debian (5.0 lenny in my case):

  • Packages go into a different installation location: /var/lib/gems vs /usr/lib/ruby/gems
  • The debian package is rubygems 1.3.6, and updating rubygems to the latest version (1.3.7) doesn't work:
  $ sudo gem update --system
  ERROR:  While executing gem ... (RuntimeError)
    gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.
  • Not all gems appear to work like they do on other systems. For instance, when installing Phusion Passenger, it did not detect the "rack" gem even though it was definitely installed.
  • Manually installing rubygems using the source tarball and reinstalling all my gems (to /usr/lib/ruby/gems) made my problems go away.

What's the deal? Why is debian's package different?

+5  A: 

Mixing to two different package managers is generally a very bad idea. The Debian-Ruby team tries their best to patch RubyGems in such a way that it becomes a slightly less bad idea.

Also, Debian has a set of rules that are intended to keep the system consistent. RubyGems also has its own set of rules. Those two sets of rules are unfortunately not compatible. So, the Debian-Ruby developers patch RubyGems to respect Debian's rules instead of RubyGems's. Moving gems from /usr/lib/ruby to /var/lib is one of those things.

Another problem is that Debian stable is, well, stable. This means that the Debian team guarantees that the behavior of the entire system, all 20000 packages, will never change during a release. But the RubyGems developers don't make their bugfixes available separately, the only way to get a bugfix is to upgrade to a new version, with (potentially) different behavior. Therefore, the Debian-Ruby developers cannot just take the RubyGems sources unmodified, they have to reverse engineer the bugfixes from 1.3.7 and apply them to their version of 1.3.6, to ensure backwards compatibility.

In general, you should avoid mixing package managers. Either use RubyGems for everything (in which case it is best to install RubyGems from source instead of using the Debian package) or use APT for everything, in which case you might be interested in DebGem, a service by the Phusion guys (makers of Ruby Enterprise Edition and Phusion Passenger) which provides Debian and Ubuntu packages for pretty much all Gems.

Jörg W Mittag
A: 

If you like to manage yourself your ruby environment, I can take a look at RVM. It is a good way to have different environments catching your dev needs, because it's wiser to let the debian packages manage the global ruby env.

Cédric Darné