Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Heroku Blog

    Find out what's new with Heroku on our blog.

    Visit Blog
  • Log inorSign up
View categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Node.js Behavior in Heroku
      • Working with Node.js
      • Troubleshooting Node.js Apps
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • Working with PHP
      • PHP Behavior in Heroku
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
    • Heroku Inference
      • AI Models
      • Inference Essentials
      • Inference API
      • Quick Start Guides
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Language Support
  • Ruby
  • Working with Bundler
  • Managing Gems with Bundler

Managing Gems with Bundler

English — 日本語に切り替える

Last updated June 28, 2024

Table of Contents

  • Using Bundler
  • Windows Support with Bundler 2.2 and Later
  • Windows Support with Bundler Before 2.2

Using Bundler

To install Bundler, run:

Commands are prefixed with > to show you must run them in a command prompt. Don’t copy the > character when you run the command.

> gem install bundler

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.0'

Add this file to the git repository since it’s part of the app. Also add the .bundle directory to your .gitignore file. After adding the Gemfile, it makes it easy for other developers to get their environment ready to run the app:

> bundle install

This command ensures that all gems specified in the Gemfile are available for your application. Running bundle install also generates a Gemfile.lock, which you must add to your git repository. The Gemfile.lock ensures that deployed versions of gems on Heroku match the version installed locally on your development machine.

If your Gemfile.lock specifies a bundler version prior to 2.2 and the PLATFORMS section of your Gemfile.lock contains Windows entries, such as mswin or mingw, then Heroku will ignore the Gemfile.lock file. We recommend upgrading to Bundler 2.2 or later.

Windows Support with Bundler 2.2 and Later

Heroku supports deploying applications developed on Windows, but production dynos will run on a different operating system). To ensure that your Heroku production application installs the same versions of gems you’re using locally for development on your Windows machine, we recommend updating your application to Bundler 2.2 or later. You can upgrade your bundler version by running the commands:

> gem install bundler
> bundle update --bundler
> bundle lock --add-platform ruby
> bundle lock --add-platform x86_64-linux
> bundle install
> git add Gemfile.lock
> git commit -m "Upgrade bundler"

After running these commands, Windows applications using bundler 2.2+ will rely on bundler’s support for multiple platforms to find and install an appropriate version.

Windows Support with Bundler Before 2.2

If your application can’t upgrade to bundler 2.2 or later, then when you deploy, the Gemfile.lock file will be deleted and regenerated. You can find more information about this behavior on the Ruby buildpack’s GitHub repository.

Keep reading

  • Working with Bundler

Feedback

Log in to submit feedback.

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices
OSZAR »