BUNDLE-CACHE(1)
π BUNDLE-CACHE(1) π
okay bestie, welcome to the bundle-cache page from the General Commands Manual section β yes that's the manual, and yes we're doing this together, grab a snack π
β¨ NAME β¨
bundle-cache β package your needed .gem files into your application π
πΈ SYNOPSIS πΈ
bundle cache [OPTIONS]
alias: package, pack
π DESCRIPTION π
So what this does is, it copies all of the .gem files you need to actually run your app into the vendor/cache directory. And then later?? when you run bundle install(1) bundle-install.1.html, it'll use the gems sitting in that cache instead of the ones on rubygems.org. It's giving "prepared, organized, thriving" β¨
π OPTIONS π
--all-platformsβ pull in gems for every platform that shows up in the lockfile, not just the one you're on right now. multi-platform queen energy π--cache-path=CACHE-PATHβ wanna put the cache somewhere other than the default (vendor/cache)? say it here, babe.--cooldown=<number>β when resolving before caching, only look at gem versions that got published at least number days ago. Pass0to switch cooldown off just for this run β which overrides any per-source or global config you've got going on. the details live undercooldowninbundle-config(1). β³--gemfile=GEMFILEβ use the gemfile you specify instead ofGemfile.--no-installβ don't install the gems, just update the cache. chill vibes only π§--quietβ only warnings and errors, no yapping. π€«
π¦ GIT AND PATH GEMS π¦
plot twist, bundle cache can also package up :git and :path dependencies, not just .gem files π you can turn that off by setting cache_all to false.
π SUPPORT FOR MULTIPLE PLATFORMS π
when your gems ship different packages for different platforms, Bundler can cache gems for other platforms too β as long as the Gemfile has been resolved for them (aka they're present in the lockfile) β and it stashes them in vendor/cache. You just gotta flip it on with the --all-platforms option. and yes, that setting gets remembered in your local bundler configuration, because she keeps receipts β¨
π REMOTE FETCHING π
By default β meaning if you run bundle install(1) bundle-install.1.html after running bundle cache(1) bundle-cache.1.html β bundler is still gonna connect to rubygems.org to check whether a platform-specific gem exists for any of the gems chillin in vendor/cache. no cap π
like, consider this Gemfile(5):
source "https://rubygems.org"
gem "nokogiri"
If you run bundle cache under C Ruby, bundler grabs the version of nokogiri for the "ruby" platform. But then if you deploy to JRuby and run bundle install, bundler is forced to check whether a "java"-platformed nokogiri exists.
and here's the tea: even though the nokogiri gem for the Ruby platform is technically acceptable on JRuby, it's got a C extension that does not run on JRuby. so as a result, bundler will β by default β still connect to rubygems.org to check whether it has a version of one of your gems that's more specific to your platform.
and bestie this is not just a "java" platform situation. a similar (and very common) problem can pop off when you develop on Windows and deploy to Linux, or even when you develop on OSX and deploy to Linux. π©
so, if you know for sure that the gems packaged in vendor/cache are appropriate for the platform you're on? you can run bundle install --local to skip checking for more appropriate gems and just use the ones in vendor/cache. slay.
one way to be sure you've got the right platformed versions of all your gems is to run bundle cache on an identical machine and check in the gems. like, you can run bundle cache on an identical staging box during your staging process, and check in the vendor/cache before deploying to production. iconic workflow, honestly π
and one more thing: by default, bundle cache(1) bundle-cache.1.html fetches and installs the gems to the default location. but if you wanna package the dependencies into vendor/cache without installing them to the local install location, just run bundle cache --no-install. π
π HISTORY π
In Bundler 2.1, cache absorbed all the functionalities of package β and now package and pack are just aliases of cache. glow-up era, fr fr π
and that's the whole page, bestie!! this version is the April 2026 release of the BUNDLE-CACHE(1) manual page from the General Commands Manual β go forth and cache your gems, you absolute main character π«Άπβ¨
π¦ where this page comes from
- fedora 44: rubygem-bundler 4.0.20-39.fc44
- fedora 44: rubygem-bundler 4.0.20-40.fc44 Β· MIT AND (Ruby OR BSD-2-Clause)
- ubuntu stonking: ruby-bundler 4.0.18-1 Β· MIT OR Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms