bundle
TLDR
Install dependencies
SYNOPSIS
bundle command [options]
DESCRIPTION
bundle (Bundler) is a dependency manager for Ruby. It ensures that the exact gem versions specified in a Gemfile are installed and loaded, preventing version conflicts and ensuring consistent environments.
The tool is essential for Ruby development and comes bundled with Ruby since version 2.6.
PARAMETERS
install
Install gems from Gemfileupdate [gems]
Update gemsexec command
Execute command with bundle environmentshow gem
Show gem installation pathlist
List installed gemsoutdated
Show outdated gemsclean
Remove unused gemslock
Create/update Gemfile.lockgem name
Create new gem scaffold
GEMFILE
Gemfile specifies dependencies:
gem 'rails', '~> 7.0'
gem 'pg', '>= 1.0'
gem 'puma'
group :development do
gem 'debug'
end
WORKFLOW
bundle install
# Update specific gem
bundle update rails
# Run command with correct gem versions
bundle exec rails server
bundle exec rake test
# Check for outdated gems
bundle outdated
# Remove unused gems
bundle clean
FEATURES
- Dependency resolution
- Version locking (Gemfile.lock)
- Isolated gem environments
- Gem groups (development, test, production)
- Local gem path override
- Git repository gems
CAVEATS
Gemfile.lock should be committed for apps (not gems). bundle exec needed to use correct versions. Local gem modifications lost on bundle install. Conflicts possible with system gems. Large projects have slow resolution.
HISTORY
Bundler was created by Carl Lerche, Yehuda Katz, and André Arko around 2009 to solve Ruby's dependency management problems, becoming the standard in 2010.


