ruby bundler

abstract

Bundler is a Ruby gem which installs Ruby gems. Bundler installs a separate bundle of gems for each software project on a machine. Keeping projects' gems separated helps developers avoid dependency hell.

basics

commands

The rake gem is used here as an example.

system commands
gem install bundler install Bundler
gem uninstall bundler uninstall Bundler
gem update bundler update Bundler
project commands
bundle clean remove unused gems
bundle exec gem list show installed gems
bundle exec irb start interactive Ruby
bundle exec ruby path/to/script.rb run a Ruby script
bundle init create a minimal Gemfile in current folder
bundle install install all gems in Gemfile
bundle show rake show path to rake
bundle update rake update rake

dependencies

examples

Example Gemfile file:

ruby '~> 2.3'
source 'https://rubygems.org' do
    gem 'nokogiri'
    gem 'rails', '3.0.0.beta3'
    gem 'rack',  '>=1.0'
    gem 'thin',  '~>1.1'
end

Example .gitignore file:

.bundle/           # Bundler config files
vendor/bundle      # Locally-installed gem files

faq

Where are the official docs?
Bundler docs
Bundler workflow
Gemfile.lock reference
Email GitHub LinkedIn
return
© Sam Kennerly 2023. Licensed under a CC BY 4.0 license.
Built by a Quarto
with icons by Simple Icons.
samkennerly@gmail.com