Docs header transparent bg
Bundler manages an application's dependencies through its entire life across many machines systematically and repeatably.

Getting Started

Getting started with bundler is easy
$ gem install bundler

If you're on an old version of RubyGems (before 1.3.6)
$ gem update --system

Specify your dependencies in a Gemfile in your project's root
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack', '~>1.1'
gem 'rspec', :require => 'spec'
Learn More: Gemfiles
Install all of the required gems from your specified sources
$ bundle install
$ git add Gemfile
Learn More: bundle install
Inside your app, load up the bundled environment
require 'rubygems'
require 'bundler'
Bundler.setup

require 'nokogiri'
# any other requires you might need
Learn More: Bundler.setup
Run a script provided by a bundled gem
$ bundle exec rackup

When you're ready to share your application or deploy it, lock down all the versions of the gems you're using
$ bundle lock
$ git add Gemfile.lock
Learn more: bundle lock

Using Bundler with Frameworks

Bundler works out of the box with Rails 3. Once you understand the basics of using bundler, you know everything you need to know. Using Bundler with Rails 3
Bundler works with Rails 2.3 with a small change to boot.rb and adding a preinitializer.rb. Using Bundler with Rails 2.3

Checking Out an Application With a Gemfile

Install the required gems
$ bundle install
Learn More: bundle install

Digging Further

Store all of the required gems in your application. All future installs will get gems from this cache, bypassing rubygems.org
$ bundle package
Learn More: bundle package
Put dependencies in a group, so they can be ignored at install time or required together in your application
group :development do
  gem 'wirble'
end
Learn more: Groups
Use a gem that is stored in git and has a .gemspec at its root. Gemspecs with bins or C extensions are supported
gem 'nokogiri', :git => 'https://github.com/tenderlove/nokogiri.git'
Learn more: Git
Use a gem that you are actively developing on your file system
gem 'nokogiri', :path => '~/Code/nokogiri'

Install gems to a different location (the default is ~/.bundle)
$ bundle install vendor --disable-shared-gems
By specifying --disable-shared-gems, you are telling bundler to install the gems into vendor, even if they are already installed in the system
Learn More: bundle install