Guides
Getting Started
Guides
Dependency Management
- How to manage application dependencies with Bundler
- How to manage dependencies with Bundler
- How to update gems with Bundler
- How to manage groups of gems
- How to install gems from git repositories
- How to develop multiple gems in one repository
- How to use Bundler with Ruby
- How to use Bundler in a single-file Ruby script
- How to deploy bundled applications
Gem Development
Publishing & Security
- Trusted Publishing
- Setting up multi-factor authentication
- Using multi-factor authentication in command line
- Managing owners using UI
- Organizations
- Removing a Published gem
- Security Practices
- How to delay new gem versions with cooldown
Integrations
- How to use Bundler with Rails
- How to use Bundler with Sinatra
- How to use Bundler with Docker
- How to use Bundler in CI
Hosting & Sources
Extending
Troubleshooting
- Troubleshooting common issues
- How to troubleshoot RubyGems and Bundler TLS/SSL Issues
- How to use git bisect with Bundler
Concepts
- What is a gem?
- Gemfile and gemspec
- Where gems are installed and how they load
- How dependency resolution works
- How Gemfile.lock works
- Versioning and compatibility
- Platforms and native gems
- Caching and vendoring
- Default gems and bundled gems
- Common Vulnerabilities and Exposures
Reference
- gem Command Reference
- Bundler Command Reference
- Gemfile Reference
- Ruby Directive
- Specification Reference
- RubyGems.org API
- RubyGems.org Compact Index API
- RubyGems.org rate limits
- API key scopes
- Bundler compatibility with Ruby
- Configuration (.gemrc)
- Environment variables
- Known Bundler Plugins
Appendix
Environment variables
The environment variables the gem command and the RubyGems runtime respond to.
None of these are required. They override defaults per shell or per process, which makes them useful in CI, in version manager hooks, and for one-off experiments. Persistent preferences belong in a gemrc file instead. See Configuration.
Paths
| Variable | Description |
|---|---|
GEM_HOME |
The directory gems are installed into. See Where gems are installed and how they load. |
GEM_PATH |
Directories searched for installed gems, separated by : on Unix and ; on Windows. |
GEM_SPEC_CACHE |
The directory where gem specifications fetched from remote sources are cached. Defaults to ~/.gem/specs, or to $XDG_CACHE_HOME/gem/specs when ~/.gem/specs does not exist. |
GEMRC |
Additional gemrc files to read, separated by : on Unix and ; on Windows. See Configuration. |
Loading gems
| Variable | Description |
|---|---|
RUBYGEMS_GEMDEPS |
Path to a gem dependencies file (Gemfile, gem.deps.rb, or Isolate) whose gems RubyGems activates automatically at startup. The special value - searches the current directory and its parents for one. Automatic discovery can execute code from a directory you do not control, so avoid - on multiuser systems. |
GEM_REQUIREMENT_<NAME> |
A version requirement applied when RubyGems activates the gem <NAME>, uppercased. For example, GEM_REQUIREMENT_BUNDLER="~> 2.7" restricts which Bundler version is activated. |
Building and pushing gems
| Variable | Description |
|---|---|
SOURCE_DATE_EPOCH |
A Unix timestamp used instead of the current time when packaging a gem, so that building the same input twice produces byte-identical .gem files. |
RUBYGEMS_HOST |
The gem server that gem push sends gems to when no --host is given. |
GEM_HOST_API_KEY |
An API key used to authenticate against the gem server instead of the key stored in ~/.gem/credentials. |
GEM_HOST_OTP_CODE |
A one-time password for pushing when the account has multi-factor authentication enabled. Equivalent to --otp. |
GEM_PRIVATE_KEY_PASSPHRASE |
The passphrase of the private signing key, read by gem cert and when building signed gems instead of prompting for it. |
Network
| Variable | Description |
|---|---|
HTTP_PROXY, HTTP_PROXY_USER, HTTP_PROXY_PASS |
The proxy server, and credentials for it, used for connections to gem servers. |
NO_PROXY |
Hosts that are connected to directly, bypassing the proxy. |
Other
| Variable | Description |
|---|---|
RUBYGEMS_PREVENT_UPDATE_SUGGESTION |
When set, the gem command never suggests running gem update --system after noticing a newer RubyGems release. |
Bundler
Bundler variables are not listed here. Every setting understood by bundle config can also be set through a corresponding BUNDLE_* environment variable, for example BUNDLE_PATH or BUNDLE_WITHOUT. See bundle config.