bundle
Manage Ruby gem dependencies for a project
TLDR
Install all gems defined in the Gemfile expected in the working directory
Execute a command in the context of the current bundle
Update all gems by the rules defined in the Gemfile and regenerate Gemfile.lock
Update one or more specific gem(s) defined in the Gemfile
Update one or more specific gems(s) defined in the Gemfile but only to the next patch version
Update all gems within the given group in the Gemfile
List installed gems in the Gemfile with newer versions available
Create a new gem skeleton
SYNOPSIS
bundle [options] <command> [<args>]
PARAMETERS
-v, --verbose
Enable verbose output
-q, --quiet
Silence Bundler output
--version
Display Bundler version
--help
Show help information
--no-color
Disable color output
--retry <number>
Retry network requests
--path <path>
Install gems to specific path
--without <groups>
Exclude gem groups
--local
Use local cached gems
--frozen
Do not allow updating Gemfile.lock
DESCRIPTION
The bundle command, part of Ruby's Bundler tool, manages gem dependencies for Ruby projects. It ensures consistent environments across development, staging, and production by installing exact gem versions specified in a Gemfile. Bundler creates a Gemfile.lock file that locks dependencies, preventing version conflicts and "it works on my machine" issues.
Key workflows include creating a Gemfile to declare dependencies, running bundle install to fetch and install gems into a vendor cache, and using bundle exec to run commands in the bundled environment. It supports groups like :development or :test for conditional loading. Bundler handles transitive dependencies automatically and provides commands for updating, checking, and visualizing dependency graphs.
Essential for modern Ruby/Rails apps, it integrates with tools like Rake and Capistrano. On Linux, install via gem install bundler or package managers like apt (ruby-bundler).
CAVEATS
Requires Ruby and gem installed. Most subcommands need a Gemfile. Network access needed for remote gems. Can increase deployment bundle size.
COMMON SUBCOMMANDS
install: Install gems from Gemfile.
update: Update gems or specific ones.
exec: Run command in bundle context.
show: List installed gems.
viz: Generate dependency graph.
EXAMPLE USAGE
$ bundle init # Create Gemfile
$ echo 'gem rails' >> Gemfile
$ bundle install
$ bundle exec rails server
HISTORY
Created by Carl Lerche in 2009 as a gem. Version 1.0 released in 2010. Integrated into Ruby core as default bundler since Ruby 2.6 (2018). Maintained by engine yard and community.


