Installing gems to which Ruby with rbenv

Greg picture Greg · Jul 10, 2013 · Viewed 14.1k times · Source

How does one control which Ruby a gem is installed to using rbenv? Or could there be a central place accessible to all Rubies? I am just running Ruby scripts not Rails. rbenv-gemset seems to be for that?

Answer

Andrew Marshall picture Andrew Marshall · Jul 10, 2013

The gem is installed into whatever your currently selected Ruby is. E.g.

rbenv shell 2.0.0-p247
gem install bundler  # bundler is installed for Ruby 2.0.0-p247 only
rbenv shell 1.9.3-p447
gem install bundler  # bundler is installed for Ruby 1.9.3-p447 only