1BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
2
3
4
6 bundle-config - Set bundler configuration options
7
9 bundle config [list|get|set|unset] [name [value]]
10
12 This command allows you to interact with Bundler´s configuration sys‐
13 tem.
14
15 Bundler loads configuration settings in this order:
16
17 1. Local config (<project_root>/.bundle/config or $BUNDLE_APP_CON‐
18 FIG/config)
19
20 2. Environmental variables (ENV)
21
22 3. Global config (~/.bundle/config)
23
24 4. Bundler default config
25
26
27
28 Executing bundle config list with will print a list of all bundler con‐
29 figuration for the current bundle, and where that configuration was
30 set.
31
32 Executing bundle config get <name> will print the value of that config‐
33 uration setting, and where it was set.
34
35 Executing bundle config set <name> <value> will set that configuration
36 to the value specified for all bundles executed as the current user.
37 The configuration will be stored in ~/.bundle/config. If name already
38 is set, name will be overridden and user will be warned.
39
40 Executing bundle config set --global <name> <value> works the same as
41 above.
42
43 Executing bundle config set --local <name> <value> will set that con‐
44 figuration in the directory for the local application. The configura‐
45 tion will be stored in <project_root>/.bundle/config. If BUN‐
46 DLE_APP_CONFIG is set, the configuration will be stored in $BUN‐
47 DLE_APP_CONFIG/config.
48
49 Executing bundle config unset <name> will delete the configuration in
50 both local and global sources.
51
52 Executing bundle config unset --global <name> will delete the configu‐
53 ration only from the user configuration.
54
55 Executing bundle config unset --local <name> <value> will delete the
56 configuration only from the local application.
57
58 Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set
59 will cause it to ignore all configuration.
60
62 Flags passed to bundle install or the Bundler runtime, such as --path
63 foo or --without production, are remembered between commands and saved
64 to your local application´s configuration (normally, ./.bundle/config).
65
66 However, this will be changed in bundler 3, so it´s better not to rely
67 on this behavior. If these options must be remembered, it´s better to
68 set them using bundle config (e.g., bundle config set --local path
69 foo).
70
71 The options that can be configured are:
72
73 bin Creates a directory (defaults to ~/bin) and place any executa‐
74 bles from the gem there. These executables run in Bundler´s con‐
75 text. If used, you might add this directory to your environ‐
76 ment´s PATH variable. For instance, if the rails gem comes with
77 a rails executable, this flag will create a bin/rails executable
78 that ensures that all referred dependencies will be resolved us‐
79 ing the bundled gems.
80
81 deployment
82 In deployment mode, Bundler will ´roll-out´ the bundle for pro‐
83 duction use. Please check carefully if you want to have this op‐
84 tion enabled in development or test environments.
85
86 path The location to install the specified gems to. This defaults to
87 Rubygems´ setting. Bundler shares this location with Rubygems,
88 gem install ... will have gem installed there, too. Therefore,
89 gems installed without a --path ... setting will show up by
90 calling gem list. Accordingly, gems installed to other locations
91 will not get listed.
92
93 without
94 A space-separated list of groups referencing gems to skip during
95 installation.
96
97 with A space-separated list of groups referencing gems to include
98 during installation.
99
101 You can use bundle config to give Bundler the flags to pass to the gem
102 installer every time bundler tries to install a particular gem.
103
104 A very common example, the mysql gem, requires Snow Leopard users to
105 pass configuration flags to gem install to specify where to find the
106 mysql_config executable.
107
108
109
110 gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
111
112
113
114 Since the specific location of that executable can change from machine
115 to machine, you can specify these flags on a per-machine basis.
116
117
118
119 bundle config set --global build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
120
121
122
123 After running this command, every time bundler needs to install the
124 mysql gem, it will pass along the flags you specified.
125
127 Configuration keys in bundler have two forms: the canonical form and
128 the environment variable form.
129
130 For instance, passing the --without flag to bundle install(1) bun‐
131 dle-install.1.html prevents Bundler from installing certain groups
132 specified in the Gemfile(5). Bundler persists this value in app/.bun‐
133 dle/config so that calls to Bundler.setup do not try to find gems from
134 the Gemfile that you didn´t install. Additionally, subsequent calls to
135 bundle install(1) bundle-install.1.html remember this setting and skip
136 those groups.
137
138 The canonical form of this configuration is "without". To convert the
139 canonical form to the environment variable form, capitalize it, and
140 prepend BUNDLE_. The environment variable form of "without" is BUN‐
141 DLE_WITHOUT.
142
143 Any periods in the configuration keys must be replaced with two under‐
144 scores when setting it via environment variables. The configuration key
145 local.rack becomes the environment variable BUNDLE_LOCAL__RACK.
146
148 The following is a list of all configuration keys and their purpose.
149 You can learn more about their operation in bundle install(1) bun‐
150 dle-install.1.html.
151
152 • allow_deployment_source_credential_changes (BUNDLE_ALLOW_DEPLOY‐
153 MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow
154 changing the credentials to a gem´s source. Ex:
155 https://some.host.com/gems/path/ -> https://user_name:pass‐
156 word@some.host.com/gems/path
157
158 • allow_offline_install (BUNDLE_ALLOW_OFFLINE_INSTALL): Allow Bundler
159 to use cached data when installing without network access.
160
161 • auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH): Automati‐
162 cally run bundle clean after installing when an explicit path has
163 not been set and Bundler is not installing into the system gems.
164
165 • auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle in‐
166 stall when gems are missing.
167
168 • bin (BUNDLE_BIN): Install executables from gems in the bundle to
169 the specified directory. Defaults to false.
170
171 • cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
172 git gems. This needs to be explicitly configured on bundler 1 and
173 bundler 2, but will be the default on bundler 3.
174
175 • cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
176 all platforms.
177
178 • cache_path (BUNDLE_CACHE_PATH): The directory that bundler will
179 place cached gems in when running bundle package, and that bundler
180 will look in when installing gems. Defaults to vendor/cache.
181
182 • clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto‐
183 matically after bundle install.
184
185 • console (BUNDLE_CONSOLE): The console that bundle console starts.
186 Defaults to irb.
187
188 • default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH):
189 Whether a bundle install without an explicit --path argument de‐
190 faults to installing gems in .bundle.
191
192 • deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
193 When the Gemfile is changed and the lockfile has not been updated,
194 running Bundler commands will be blocked.
195
196 • disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
197 Allow installing gems even if they do not match the checksum pro‐
198 vided by RubyGems.
199
200 • disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from us‐
201 ing load to launch an executable in-process in bundle exec.
202
203 • disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK): Al‐
204 low Bundler to use a local git override without a branch specified
205 in the Gemfile.
206
207 • disable_local_revision_check (BUNDLE_DISABLE_LOCAL_REVISION_CHECK):
208 Allow Bundler to use a local git override without checking if the
209 revision present in the lockfile is present in the repository.
210
211 • disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
212 accessing gems installed to RubyGems´ normal location.
213
214 • disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
215 from checking if a newer Bundler version is available on
216 rubygems.org.
217
218 • force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur‐
219 rent machine´s platform and install only ruby platform gems. As a
220 result, gems with native extensions will be compiled from source.
221
222 • frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
223 Gemfile is changed and the lockfile has not been updated, running
224 Bundler commands will be blocked. Defaults to true when --deploy‐
225 ment is used.
226
227 • gem.github_username (BUNDLE_GEM__GITHUB_USERNAME): Sets a GitHub
228 username or organization to be used in README file when you create
229 a new gem via bundle gem command. It can be overridden by passing
230 an explicit --github-username flag to bundle gem.
231
232 • gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
233 gem push when using the rake release command with a private gem‐
234 stash server.
235
236 • gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
237 use as the Gemfile. This location of this file also sets the root
238 of the project, which is used to resolve relative paths in the Gem‐
239 file, among other things. By default, bundler will search up from
240 the current working directory until it finds a Gemfile.
241
242 • global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
243 cache all gems globally, rather than locally to the installing Ruby
244 installation.
245
246 • ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
247 messages will be printed. To silence a single gem, use dot notation
248 like ignore_messages.httparty true.
249
250 • init_gems_rb (BUNDLE_INIT_GEMS_RB): Generate a gems.rb instead of a
251 Gemfile when running bundle init.
252
253 • jobs (BUNDLE_JOBS): The number of gems Bundler can install in par‐
254 allel. Defaults to the number of available processors.
255
256 • no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
257 installing gems.
258
259 • no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
260 gems unpruned when caching.
261
262 • path (BUNDLE_PATH): The location on disk where all gems in your
263 bundle will be located regardless of $GEM_HOME or $GEM_PATH values.
264 Bundle gems not found in this location will be installed by bundle
265 install. Defaults to Gem.dir. When --deployment is used, defaults
266 to vendor/bundle.
267
268 • path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
269 gems into the default system path (Gem.dir).
270
271 • path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
272 relative to the CWD instead of the Gemfile.
273
274 • plugins (BUNDLE_PLUGINS): Enable Bundler´s experimental plugin sys‐
275 tem.
276
277 • prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
278 patch version during updates. Makes bundle update calls equivalent
279 to bundler update --patch.
280
281 • print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER): Print
282 only version number from bundler --version.
283
284 • redirect (BUNDLE_REDIRECT): The number of redirects allowed for
285 network requests. Defaults to 5.
286
287 • retry (BUNDLE_RETRY): The number of times to retry failed network
288 requests. Defaults to 3.
289
290 • setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB‐
291 LIC): Have Bundler.setup make the Kernel#gem method public, even
292 though RubyGems declares it as private.
293
294 • shebang (BUNDLE_SHEBANG): The program name that should be invoked
295 for generated binstubs. Defaults to the ruby install name used to
296 generate the binstub.
297
298 • silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
299 should silence deprecation warnings for behavior that will be
300 changed in the next major version.
301
302 • silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
303 warning Bundler prints when installing gems as root.
304
305 • ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi‐
306 cate file or folder containing multiple certificates for trusted
307 CAs in PEM format.
308
309 • ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
310 containing a X.509 client certificate and key in PEM format.
311
312 • ssl_verify_mode (BUNDLE_SSL_VERIFY_MODE): The SSL verification mode
313 Bundler uses when making HTTPS requests. Defaults to verify peer.
314
315 • suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES‐
316 SAGES): Avoid printing Using ... messages during installation when
317 the version of a gem has not changed.
318
319 • system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
320 installs binstubs. Defaults to Gem.bindir.
321
322 • timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
323 network requests. Defaults to 10.
324
325 • update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG): Require
326 passing --all to bundle update when everything should be updated,
327 and disallow passing no options to bundle update.
328
329 • user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
330 Bundler includes in API requests.
331
332 • with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
333 should install.
334
335 • without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
336 bundler should not install.
337
338
339
340 In general, you should set these settings per-application by using the
341 applicable flag to the bundle install(1) bundle-install.1.html or bun‐
342 dle package(1) bundle-package.1.html command.
343
344 You can set them globally either via environment variables or bundle
345 config, whichever is preferable for your setup. If you use both, envi‐
346 ronment variables will take preference over global settings.
347
349 Bundler also allows you to work against a git repository locally in‐
350 stead of using the remote version. This can be achieved by setting up a
351 local override:
352
353
354
355 bundle config set --local local.GEM_NAME /path/to/local/git/repository
356
357
358
359 For example, in order to use a local Rack repository, a developer could
360 call:
361
362
363
364 bundle config set --local local.rack ~/Work/git/rack
365
366
367
368 Now instead of checking out the remote git repository, the local over‐
369 ride will be used. Similar to a path source, every time the local git
370 repository change, changes will be automatically picked up by Bundler.
371 This means a commit in the local git repo will update the revision in
372 the Gemfile.lock to the local git repo revision. This requires the same
373 attention as git submodules. Before pushing to the remote, you need to
374 ensure the local override was pushed, otherwise you may point to a com‐
375 mit that only exists in your local machine. You´ll also need to CGI es‐
376 cape your usernames and passwords as well.
377
378 Bundler does many checks to ensure a developer won´t work with invalid
379 references. Particularly, we force a developer to specify a branch in
380 the Gemfile in order to use this feature. If the branch specified in
381 the Gemfile and the current branch in the local git repository do not
382 match, Bundler will abort. This ensures that a developer is always
383 working against the correct branches, and prevents accidental locking
384 to a different branch.
385
386 Finally, Bundler also ensures that the current revision in the Gem‐
387 file.lock exists in the local git repository. By doing this, Bundler
388 forces you to fetch the latest changes in the remotes.
389
391 Bundler supports overriding gem sources with mirrors. This allows you
392 to configure rubygems.org as the gem source in your Gemfile while still
393 using your mirror to fetch gems.
394
395
396
397 bundle config set --global mirror.SOURCE_URL MIRROR_URL
398
399
400
401 For example, to use a mirror of rubygems.org hosted at rubygems-mir‐
402 ror.org:
403
404
405
406 bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org
407
408
409
410 Each mirror also provides a fallback timeout setting. If the mirror
411 does not respond within the fallback timeout, Bundler will try to use
412 the original server instead of the mirror.
413
414
415
416 bundle config set --global mirror.SOURCE_URL.fallback_timeout TIMEOUT
417
418
419
420 For example, to fall back to rubygems.org after 3 seconds:
421
422
423
424 bundle config set --global mirror.https://rubygems.org.fallback_timeout 3
425
426
427
428 The default fallback timeout is 0.1 seconds, but the setting can cur‐
429 rently only accept whole seconds (for example, 1, 15, or 30).
430
432 Bundler allows you to configure credentials for any gem source, which
433 allows you to avoid putting secrets into your Gemfile.
434
435
436
437 bundle config set --global SOURCE_HOSTNAME USERNAME:PASSWORD
438
439
440
441 For example, to save the credentials of user claudette for the gem
442 source at gems.longerous.com, you would run:
443
444
445
446 bundle config set --global gems.longerous.com claudette:s00pers3krit
447
448
449
450 Or you can set the credentials as an environment variable like this:
451
452
453
454 export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
455
456
457
458 For gems with a git source with HTTP(S) URL you can specify credentials
459 like so:
460
461
462
463 bundle config set --global https://github.com/rubygems/rubygems.git username:password
464
465
466
467 Or you can set the credentials as an environment variable like so:
468
469
470
471 export BUNDLE_GITHUB__COM=username:password
472
473
474
475 This is especially useful for private repositories on hosts such as
476 GitHub, where you can use personal OAuth tokens:
477
478
479
480 export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
481
482
483
484 Note that any configured credentials will be redacted by informative
485 commands such as bundle config list or bundle config get, unless you
486 use the --parseable flag. This is to avoid unintentionally leaking cre‐
487 dentials when copy-pasting bundler output.
488
489 Also note that to guarantee a sane mapping between valid environment
490 variable names and valid host names, bundler makes the following trans‐
491 formations:
492
493 • Any - characters in a host name are mapped to a triple dash (___)
494 in the corresponding environment variable.
495
496 • Any . characters in a host name are mapped to a double dash (__) in
497 the corresponding environment variable.
498
499
500
501 This means that if you have a gem server named my.gem-host.com, you´ll
502 need to use the BUNDLE_MY__GEM___HOST__COM variable to configure cre‐
503 dentials for it through ENV.
504
506 Bundler´s home, config, cache and plugin directories are able to be
507 configured through environment variables. The default location for
508 Bundler´s home directory is ~/.bundle, which all directories inherit
509 from by default. The following outlines the available environment vari‐
510 ables and their default values
511
512
513
514 BUNDLE_USER_HOME : $HOME/.bundle
515 BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
516 BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
517 BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
518
519
520
521
522
523
524 December 2021 BUNDLE-CONFIG(1)