Back to Web-Dev

Ruby dependency manager. Uses Gemfiles. gem install bundler. Example of Gemfile:

source 'https://rubygems.org
gem 'nokogiri'
gem 'rack', '~>1.1'
gem 'rspec', :require => 'spec'

Then inside app, require 'rubygems' and require 'bundler/setup'

Gemfile + Gemfile.lock -- source

source 'https://rubygems.org' defines which upstream to pull gems from.

bundle install -- source

Installs gems specified in the Gemfile.

Conservative Updating

As safety, bundler will not automatically update a gem whose dependency versions conflict with the Gemfile.lock. This means if gem A and B depend of C, when A is updated, requiring a new version of C, B will never break from this, at worst failing loudly.

Tracing a bundle install

  1. executable bundle
  2. requires bundler
  3. requires cli, passed to install command
  4. Installer.install
  5. ParallelInstaller.call
  6. Builds a pool of Workers
  7. Gem installer is called


a cache for remote servers (including rubygems.org) and a private gem source. By default, it is a local cache.

# Tell Bundler that you want Gemstash to find gems:
bundle config mirror.https://rubygems.org http://localhost:9292

# set Bundler to fallback to rubygems.org
bundle config mirror.https://rubygems.org.fallback_timeout true
bundle config mirror.https://rubygems.org.fallback_timeout 3

Gemstash lives is ~/.gemstash, stores cached & private gems

Gem in a box

Another gem caching solution, older than gemstash, more of a gem server than a cache. Uses gemirro, as a dependency for creating a RubyGems mirror.