Bundler

Manage ruby gems

What is Bundler?

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed.

Bundler relies on RubyGems, a package management framework for Ruby libraries and applications (the gems).

Installation

$ gem install bundler

Usage

Gemfile

Ruby dependencies of a project are defined in a gemfile at the root directory.

source 'https://rubygems.org'
ruby '2.6.3'

gem 'pg', '~> 1.1.4'
gem 'rails', '~> 5.1.7'
...

To install all the dependencies before to start working of a project that contains a Gemfile, you just need to run:

$ bundle install

Besides installing all the dependencies in your local environment, the command also generates a Gemfile.lock file, which contains the exact version number of each installed gem. The Gemfile.lock is used during deployement to ensure the gem versions used in production are the same than the ones used in development.

Run a gem executable

To run an executable that comes with a gem in your bundle:

# to launch sidekiq
$ bundle exec sidekiq

Gemfile Syntax

More info about the gemfile syntax:

Last updated