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?
Asked
Active
Viewed 1.9k times
2 Answers
25
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

Andrew Marshall
- 95,083
- 20
- 220
- 214
-
Thank you. And your example suggests that I can just change the shell to make those changes. I didn't want to change the global Ruby to install. And further your example suggest that bundler only works on the Ruby you're working in. I hadn't looked at bundler, but since it manages Rubies, I thought that might be the way to go, but seems not for my non-Rails use. – Greg Jul 11 '13 at 16:43
-
Bundler does not manage Ruby versions, it manages gem dependencies. – Andrew Marshall Jul 11 '13 at 22:43
-
Thanks again. That's kind of what I thought. I'm still having trouble with installing to system and 1.8.7. Need to spend some time seeing what is where because I install a gem and then it's not available. – Greg Jul 12 '13 at 17:28
1
Just to add on: rbenv-gemset
would be for organizing your gems within the same ruby version. Only rbenv
controls which ruby you install your gems to...

Jeffrey 'jf' Lim
- 425
- 3
- 9