gem vs apt-get in a server environment

I don't use apt-get, as I run NetBSD, but "pkgsrc" has a similar role as apt-get.

My local policy is very simple. If I can use a gem, I use a gem. If I cannot, I get it from pkgsrc. Some things which require native code (sqlite, a few others) simply do not reliably install as gems out of the box.

The major benefit I see to using a gem for most things is that I can have more than one version installed at once. For instance, I have 3 different version of Rails installed, and applications can be slowly migrated from one to another.

I'm not certain if apt-get would let you do this, but I know pkgsrc does not. It's a feature I need and use.


One thing to keep in mind is that updates will happen much faster using gem than they will to the official apt repositories. Perhaps there are third party repositories that are more up-to-date, I'm not sure. However, my impression is that if you need bleeding-edge newness, then update using gem.


Our policy is that we use gems when there's no debs "downstream" in the dependency chain (so usually customer-deployed and managed code), but everything we do ourselves is packaged properly and so we'll roll any dependent gems into debs to satisfy those dependencies. The different packaging systems shouldn't be a problem; your system management automation tool should be capable of handling the differences gracefully.


I draw the line in the sand at updates quick vs stable is ok

Example I deploy on hardy, if Ruby 1.8.6 is acceptable, otherwise, the latest released Ubuntu if I need 1.8.7

I then install the rubygems tarball as you need the close to latest version for Rails 2.3.4, and then install passenger etc using gems.

Situations such as rmagick where you need to have imagemagick installed, I use the system debs for imagemagick and then install the rmagick gem


Building debs from gems can be automated. Python, OCaml, Cabal and CPAN packages are straightforward. debgem is a gem-to-deb service with 25k packages, but it seems it didn't take off and lags a few rails releases.