Table of Contents [expand]
Last updated October 20, 2025
Using Bundler Locally
All currently supported versions of Ruby on Heroku have a default version of bundler. You can install a specific version by running the command:
$ gem install bundler -v <version>
To manage gems in your project, create a file named Gemfile in the root of your app specifying what gems are required to run it:
source "https://rubygems.org"
gem 'sinatra', '4.2.1'
Run this command to install those libraries (gems) locally:
$ bundle install
This will also update the file Gemfile.lock on disk. This contains resolved information about what dependencies were installed so that running the same command with the same Gemfile.lock should have the same result.
Once you’ve generated these files add them to your git repository:
$ git add Gemfile Gemfile.lock
$ git commit -m "Manage libraries with bundler"
Consider adding the .bundle directory to your .gitignore file. This directory contains local configuration that might conflict with Heroku’s configuration.
Heroku Bundler Behavior
When you deploy your application to Heroku, the heroku/ruby buildpack will detect the Gemfile.lock and install dependencies that match your Gemfile.lock. When you git push heroku you will see the exact bundler command being run to install libraries for your Heroku app. Follow a Heroku Ruby tutorial to see the process.
For more information on Bundler behavior on the Heroku platform see: