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?
Rbenv is a command line tool that lets you switch between installed versions of Ruby. It can also install new versions of Ruby using the ruby-build plugin.
One of those is the ruby-build project, which also provides an optional plugin for Rbenv that provides an rbenv install subcommand. This plugin will typically install Ruby implementations in ~/. rbenv/versions/* , but that is configurable.
Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.
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
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With