15

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,919

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,663
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,384