Rails gems are application libraries. Use Bundler to manage your ruby on rails application's dependencies by installing all the required gems.
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
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]'
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
To view a list of gems that have been installed with your application, use:
$gem list
To view where a particular gem has been installed, use:
$bundle show [bundlename]
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