Docs header transparent bg

bundle package

Locks and then caches the gems into ./vendor/cache.
$ bundle package [--no-prune] [--all]

Options:

--no-prune: Don't remove stale gems from the cache.

--all: package :git, :path, and .gem dependencies. Once used, the --all option will be remembered.

The package command will copy the .gem files for your gems in the bundle into ./vendor/cache. Afterward, when you run bundle install, Bundler will use the gems in the cache in preference to the ones on rubygems.org.

Additionally, if you then check that directory into your source control repository, others who check out your source will be able to install the bundle without having to download any additional gems.

Lock and cache gems from RubyGems into ./vendor/cache.
$ bundle package

By default, if you simply run bundle install after running bundle package, Bundler will still connect to rubygems.org to check whether a platform-specific gem exists for any of the gems in vendor/cache.

This behavior can be avoided by instead running bundle install --local. Note that this requires you to have the correctly platformed version for all of your gems already cached. The easiest way to achieve this is to run bundle package on an identical machine and then check in those vendored gems.

Lock and cache gems from RubyGems into ./vendor/cache, and don't remove any stale gems from the existing cache.
$ bundle package --no-prune

Lock and cache all gems into ./vendor/cache, including :git, :path, and .gem dependencies.
$ bundle package --all

Once used, the --all option will be remembered.

This will be the default on Bundler 2.0.

Edit this document on GitHub if you caught an error or noticed something was missing.