14

If a package is available both through apt-get and gem, which one should I choose?

I'm on Ubuntu and I don't know if I should install rake through apt-get or gem.

I use both apt-get and gem packages a lot.

What are the pros and cons with each?

ajsie
  • 1,871
  • 4
  • 23
  • 30
  • Wrong forum to post this on, this is more of a superuser.com question... when it closes, it will be migrated across.... – t0mm13b Aug 19 '10 at 22:48
  • @tommieb75: I can see why this would fit in SU, but I'm kind of surprised that it's not seen as programming-related. – Andrew Grimm Aug 19 '10 at 23:41
  • @Andrew: where does it say anything in the question in relation to programming....???!!! I do not see it... :) This is the right place for it and answers are below....! ;) – t0mm13b Aug 25 '10 at 22:17

2 Answers2

8

You should use

apt-get

  • If you care about uninstalling gems with their dependencies. RubyGems will not uninstall unused dependencies. See do-i-have-to-manually-uninstall-all-dependent-gems. If you care about uninstalling gems as a group, rvm is also an option (see below).
  • If that gem would or should install executables in /usr/bin.
  • If you want to upgrade gems together with the rest of the system (automatically)

gem

  • If you want the most simple approach
  • If you want to have multiple versions of a gem available on the system
  • Need very recent or very old versions of some gems
  • Want to install only for one user

bundler

  • If you want to install certain gems only for one application

rvm + gem

  • If you need different sets of gems installed or removed independently

You should not mix between using apt-get and gem arbitrarily. That means you should not, but when you do; you should know and remember why you did this.

When you use different methods, the overall system gets more complex.

JonnyJD
  • 3,623
  • 3
  • 18
  • 21
  • Please comment if some main reasons or consequences are missing. I still don't feel like I know the perfect solution myself. – JonnyJD Dec 22 '12 at 20:31
4

You should always use RubyGems to install any kind of Gems (eg. Rails) to reduce confusion.

Ruby on Rails: gem install versus apt-get

zengr
  • 1,354
  • 2
  • 16
  • 27