/home/web-programming/rubyonrails/

Rails Gem Bundle Install

Rails gems are application libraries. Use Bundler to manage your ruby on rails application's dependencies by installing all the required gems.

Step One: Install Bundler

Open a terminal window on a computer connected to the internet and cd to the application directory, then, enter the following at the command line.

$gem install bundler

Step Two: Add Gems to Gemfile

Find the Gemfile in your project's root folder and add the following code to this file.

source 'https://rubygems.org'
gem '[nameofgem]'
gem '[nameofgem]', '~>[versionofgem]'
gem '[nameofgem]', :require => '[spec]'

Step Three: Install Required Gems

Ask bundle to install all the gems specified in the Gemfile to your application.

$bundle install

If you are using a database in development mode that is different from the database to be used in production mode, use this instead:

$bundle install --without production

Step Four: Review Installed Gems

To view a list of gems that have been installed with your application, use:

$gem list

Step Five: Bundle Show

To view where a particular gem has been installed, use:

$bundle show [bundlename]

Step Six: Add Gemfile and Gemfile.lock to Repository

If you are building an application with a team, add the Gemfile and Gemfile.lock files to your repository so that all team members use the same gems.

$git add Gemfile Gemfile.lock