3

I have setup ruby and rails using rbenv.

$ which ruby
~/.rbenv/shims/ruby
$ which rails
~/.rbenv/shims/rails

I want to install two gems i.e. activesupport and i18n. Is the procedure same i.e. Go to terminal> type the following:

$gem install activesupport 
$gem install i18n

or for rbenv manager there is some other way? I don't want to break anything.

Details:

rbenv version 0.4.0. 
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15]
Joshua Cook
  • 12,495
  • 2
  • 35
  • 31
abhimanyuaryan
  • 3,882
  • 5
  • 41
  • 83

1 Answers1

3

I prefer to use a Gemfile in the directory of the project I am working on.

Your Gemfile might look like

gem 'activesupport'
gem 'i18n'

Then run

$ bundle install

This will pull the latest versions of these gems and save them according to your defined rbenv.

Not only that. In terms of your concerns about "breaking things", when you run bundle install a Gemfile.lock file will be created detailing the current versions of the gems used specific to the project of the directory you are working in.

Joshua Cook
  • 12,495
  • 2
  • 35
  • 31
  • I not using any IDE like RubyMines etc. I want to practice this in single ruby file. In any directory globally. To use these gem files I want that all I need to do is `require 'activesupport/all'` – abhimanyuaryan Oct 24 '15 at 05:15
  • This is all straight from the command line ... No IDE here. Here is a great summary of using `rbenv` with `bundler`: https://cbednarski.com/articles/installing-ruby/ – Joshua Cook Oct 24 '15 at 05:35