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 1 on Windows, and to the the number of proces‐
255 sors on other platforms.
256
257 • no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
258 installing gems.
259
260 • no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
261 gems unpruned when caching.
262
263 • path (BUNDLE_PATH): The location on disk where all gems in your
264 bundle will be located regardless of $GEM_HOME or $GEM_PATH values.
265 Bundle gems not found in this location will be installed by bundle
266 install. Defaults to Gem.dir. When --deployment is used, defaults
267 to vendor/bundle.
268
269 • path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
270 gems into the default system path (Gem.dir).
271
272 • path_relative_to_cwd (BUNDLE_PATH_RELATIVE_TO_CWD) Makes --path
273 relative to the CWD instead of the Gemfile.
274
275 • plugins (BUNDLE_PLUGINS): Enable Bundler´s experimental plugin sys‐
276 tem.
277
278 • prefer_patch (BUNDLE_PREFER_PATCH): Prefer updating only to next
279 patch version during updates. Makes bundle update calls equivalent
280 to bundler update --patch.
281
282 • print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER): Print
283 only version number from bundler --version.
284
285 • redirect (BUNDLE_REDIRECT): The number of redirects allowed for
286 network requests. Defaults to 5.
287
288 • retry (BUNDLE_RETRY): The number of times to retry failed network
289 requests. Defaults to 3.
290
291 • setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB‐
292 LIC): Have Bundler.setup make the Kernel#gem method public, even
293 though RubyGems declares it as private.
294
295 • shebang (BUNDLE_SHEBANG): The program name that should be invoked
296 for generated binstubs. Defaults to the ruby install name used to
297 generate the binstub.
298
299 • silence_deprecations (BUNDLE_SILENCE_DEPRECATIONS): Whether Bundler
300 should silence deprecation warnings for behavior that will be
301 changed in the next major version.
302
303 • silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
304 warning Bundler prints when installing gems as root.
305
306 • ssl_ca_cert (BUNDLE_SSL_CA_CERT): Path to a designated CA certifi‐
307 cate file or folder containing multiple certificates for trusted
308 CAs in PEM format.
309
310 • ssl_client_cert (BUNDLE_SSL_CLIENT_CERT): Path to a designated file
311 containing a X.509 client certificate and key in PEM format.
312
313 • ssl_verify_mode (BUNDLE_SSL_VERIFY_MODE): The SSL verification mode
314 Bundler uses when making HTTPS requests. Defaults to verify peer.
315
316 • suppress_install_using_messages (BUNDLE_SUPPRESS_INSTALL_USING_MES‐
317 SAGES): Avoid printing Using ... messages during installation when
318 the version of a gem has not changed.
319
320 • system_bindir (BUNDLE_SYSTEM_BINDIR): The location where RubyGems
321 installs binstubs. Defaults to Gem.bindir.
322
323 • timeout (BUNDLE_TIMEOUT): The seconds allowed before timing out for
324 network requests. Defaults to 10.
325
326 • update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG): Require
327 passing --all to bundle update when everything should be updated,
328 and disallow passing no options to bundle update.
329
330 • user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
331 Bundler includes in API requests.
332
333 • with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
334 should install.
335
336 • without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
337 bundler should not install.
338
339
340
341 In general, you should set these settings per-application by using the
342 applicable flag to the bundle install(1) bundle-install.1.html or bun‐
343 dle package(1) bundle-package.1.html command.
344
345 You can set them globally either via environment variables or bundle
346 config, whichever is preferable for your setup. If you use both, envi‐
347 ronment variables will take preference over global settings.
348
350 Bundler also allows you to work against a git repository locally in‐
351 stead of using the remote version. This can be achieved by setting up a
352 local override:
353
354
355
356 bundle config set --local local.GEM_NAME /path/to/local/git/repository
357
358
359
360 For example, in order to use a local Rack repository, a developer could
361 call:
362
363
364
365 bundle config set --local local.rack ~/Work/git/rack
366
367
368
369 Now instead of checking out the remote git repository, the local over‐
370 ride will be used. Similar to a path source, every time the local git
371 repository change, changes will be automatically picked up by Bundler.
372 This means a commit in the local git repo will update the revision in
373 the Gemfile.lock to the local git repo revision. This requires the same
374 attention as git submodules. Before pushing to the remote, you need to
375 ensure the local override was pushed, otherwise you may point to a com‐
376 mit that only exists in your local machine. You´ll also need to CGI es‐
377 cape your usernames and passwords as well.
378
379 Bundler does many checks to ensure a developer won´t work with invalid
380 references. Particularly, we force a developer to specify a branch in
381 the Gemfile in order to use this feature. If the branch specified in
382 the Gemfile and the current branch in the local git repository do not
383 match, Bundler will abort. This ensures that a developer is always
384 working against the correct branches, and prevents accidental locking
385 to a different branch.
386
387 Finally, Bundler also ensures that the current revision in the Gem‐
388 file.lock exists in the local git repository. By doing this, Bundler
389 forces you to fetch the latest changes in the remotes.
390
392 Bundler supports overriding gem sources with mirrors. This allows you
393 to configure rubygems.org as the gem source in your Gemfile while still
394 using your mirror to fetch gems.
395
396
397
398 bundle config set --global mirror.SOURCE_URL MIRROR_URL
399
400
401
402 For example, to use a mirror of rubygems.org hosted at rubygems-mir‐
403 ror.org:
404
405
406
407 bundle config set --global mirror.http://rubygems.org http://rubygems-mirror.org
408
409
410
411 Each mirror also provides a fallback timeout setting. If the mirror
412 does not respond within the fallback timeout, Bundler will try to use
413 the original server instead of the mirror.
414
415
416
417 bundle config set --global mirror.SOURCE_URL.fallback_timeout TIMEOUT
418
419
420
421 For example, to fall back to rubygems.org after 3 seconds:
422
423
424
425 bundle config set --global mirror.https://rubygems.org.fallback_timeout 3
426
427
428
429 The default fallback timeout is 0.1 seconds, but the setting can cur‐
430 rently only accept whole seconds (for example, 1, 15, or 30).
431
433 Bundler allows you to configure credentials for any gem source, which
434 allows you to avoid putting secrets into your Gemfile.
435
436
437
438 bundle config set --global SOURCE_HOSTNAME USERNAME:PASSWORD
439
440
441
442 For example, to save the credentials of user claudette for the gem
443 source at gems.longerous.com, you would run:
444
445
446
447 bundle config set --global gems.longerous.com claudette:s00pers3krit
448
449
450
451 Or you can set the credentials as an environment variable like this:
452
453
454
455 export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
456
457
458
459 For gems with a git source with HTTP(S) URL you can specify credentials
460 like so:
461
462
463
464 bundle config set --global https://github.com/rubygems/rubygems.git username:password
465
466
467
468 Or you can set the credentials as an environment variable like so:
469
470
471
472 export BUNDLE_GITHUB__COM=username:password
473
474
475
476 This is especially useful for private repositories on hosts such as
477 Github, where you can use personal OAuth tokens:
478
479
480
481 export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
482
483
484
485 Note that any configured credentials will be redacted by informative
486 commands such as bundle config list or bundle config get, unless you
487 use the --parseable flag. This is to avoid unintentially leaking cre‐
488 dentials when copy-pasting bundler output.
489
490 Also note that to guarantee a sane mapping between valid environment
491 variable names and valid host names, bundler makes the following trans‐
492 formations:
493
494 • Any - characters in a host name are mapped to a triple dash (___)
495 in the corresponding enviroment variable.
496
497 • Any . characters in a host name are mapped to a double dash (__) in
498 the corresponding environment variable.
499
500
501
502 This means that if you have a gem server named my.gem-host.com, you´ll
503 need to use the BUNDLE_MY__GEM___HOST__COM variable to configure cre‐
504 dentials for it through ENV.
505
507 Bundler´s home, config, cache and plugin directories are able to be
508 configured through environment variables. The default location for
509 Bundler´s home directory is ~/.bundle, which all directories inherit
510 from by default. The following outlines the available environment vari‐
511 ables and their default values
512
513
514
515 BUNDLE_USER_HOME : $HOME/.bundle
516 BUNDLE_USER_CACHE : $BUNDLE_USER_HOME/cache
517 BUNDLE_USER_CONFIG : $BUNDLE_USER_HOME/config
518 BUNDLE_USER_PLUGIN : $BUNDLE_USER_HOME/plugin
519
520
521
522
523
524
525 June 2021 BUNDLE-CONFIG(1)