1BUNDLE-CONFIG(1) BUNDLE-CONFIG(1)
2
3
4
6 bundle-config - Set bundler configuration options
7
9 bundle config [name [value]]
10
12 This command allows you to interact with bundler´s configuration sys‐
13 tem. Bundler retrieves its configuration from the local application
14 (app/.bundle/config), environment variables, and the user´s home direc‐
15 tory (~/.bundle/config), in that order of priority.
16
17 Executing bundle config with no parameters will print a list of all
18 bundler configuration for the current bundle, and where that configura‐
19 tion was set.
20
21 Executing bundle config <name> will print the value of that configura‐
22 tion setting, and where it was set.
23
24 Executing bundle config <name> <value> will set that configuration to
25 the value specified for all bundles executed as the current user. The
26 configuration will be stored in ~/.bundle/config. If name already is
27 set, name will be overridden and user will be warned.
28
29 Executing bundle config --global <name> <value> works the same as
30 above.
31
32 Executing bundle config --local <name> <value> will set that configura‐
33 tion to the local application. The configuration will be stored in
34 app/.bundle/config.
35
36 Executing bundle config --delete <name> will delete the configuration
37 in both local and global sources. Not compatible with --global or
38 --local flag.
39
40 Executing bundle with the BUNDLE_IGNORE_CONFIG environment variable set
41 will cause it to ignore all configuration.
42
43 Executing bundle config disable_multisource true upgrades the warning
44 about the Gemfile containing multiple primary sources to an error. Exe‐
45 cuting bundle config --delete disable_multisource downgrades this error
46 to a warning.
47
49 Flags passed to bundle install or the Bundler runtime, such as --path
50 foo or --without production, are not remembered between commands. If
51 these options must be remembered,they must be set using bundle config
52 (e.g., bundle config path foo).
53
54 The options that can be configured are:
55
56 bin Creates a directory (defaults to ~/bin) and place any executa‐
57 bles from the gem there. These executables run in Bundler´s con‐
58 text. If used, you might add this directory to your environ‐
59 ment´s PATH variable. For instance, if the rails gem comes with
60 a rails executable, this flag will create a bin/rails executable
61 that ensures that all referred dependencies will be resolved
62 using the bundled gems.
63
64 deployment
65 In deployment mode, Bundler will ´roll-out´ the bundle for pro‐
66 duction use. Please check carefully if you want to have this
67 option enabled in development or test environments.
68
69 path The location to install the specified gems to. This defaults to
70 Rubygems´ setting. Bundler shares this location with Rubygems,
71 gem install ... will have gem installed there, too. Therefore,
72 gems installed without a --path ... setting will show up by
73 calling gem list. Accordingly, gems installed to other locations
74 will not get listed.
75
76 without
77 A space-separated list of groups referencing gems to skip during
78 installation.
79
80 with A space-separated list of groups referencing gems to include
81 during installation.
82
84 You can use bundle config to give bundler the flags to pass to the gem
85 installer every time bundler tries to install a particular gem.
86
87 A very common example, the mysql gem, requires Snow Leopard users to
88 pass configuration flags to gem install to specify where to find the
89 mysql_config executable.
90
91
92
93 gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
94
95
96
97 Since the specific location of that executable can change from machine
98 to machine, you can specify these flags on a per-machine basis.
99
100
101
102 bundle config build.mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
103
104
105
106 After running this command, every time bundler needs to install the
107 mysql gem, it will pass along the flags you specified.
108
110 Configuration keys in bundler have two forms: the canonical form and
111 the environment variable form.
112
113 For instance, passing the --without flag to [bundle install(1)][bun‐
114 dle-install] prevents Bundler from installing certain groups specified
115 in the Gemfile(5). Bundler persists this value in app/.bundle/config so
116 that calls to Bundler.setup do not try to find gems from the Gemfile
117 that you didn´t install. Additionally, subsequent calls to [bundle
118 install(1)][bundle-install] remember this setting and skip those
119 groups.
120
121 The canonical form of this configuration is "without". To convert the
122 canonical form to the environment variable form, capitalize it, and
123 prepend BUNDLE_. The environment variable form of "without" is BUN‐
124 DLE_WITHOUT.
125
126 Any periods in the configuration keys must be replaced with two under‐
127 scores when setting it via environment variables. The configuration key
128 local.rack becomes the environment variable BUNDLE_LOCAL__RACK.
129
131 The following is a list of all configuration keys and their purpose.
132 You can learn more about their operation in [bundle install(1)][bun‐
133 dle-install].
134
135 · allow_bundler_dependency_conflicts (BUNDLE_ALLOW_BUNDLER_DEPEN‐
136 DENCY_CONFLICTS): Allow resolving to specifications that have
137 dependencies on bundler that are incompatible with the running
138 Bundler version.
139
140 · allow_deployment_source_credential_changes (BUNDLE_ALLOW_DEPLOY‐
141 MENT_SOURCE_CREDENTIAL_CHANGES): When in deployment mode, allow
142 changing the credentials to a gem´s source. Ex:
143 https://some.host.com/gems/path/ -> https://user_name:pass‐
144 word@some.host.com/gems/path
145
146 · allow_offline_install (BUNDLE_ALLOW_OFFLINE_INSTALL): Allow Bundler
147 to use cached data when installing without network access.
148
149 · auto_clean_without_path (BUNDLE_AUTO_CLEAN_WITHOUT_PATH): Automati‐
150 cally run bundle clean after installing when an explicit path has
151 not been set and Bundler is not installing into the system gems.
152
153 · auto_install (BUNDLE_AUTO_INSTALL): Automatically run bundle
154 install when gems are missing.
155
156 · bin (BUNDLE_BIN): Install executables from gems in the bundle to
157 the specified directory. Defaults to false.
158
159 · cache_all (BUNDLE_CACHE_ALL): Cache all gems, including path and
160 git gems.
161
162 · cache_all_platforms (BUNDLE_CACHE_ALL_PLATFORMS): Cache gems for
163 all platforms.
164
165 · cache_path (BUNDLE_CACHE_PATH): The directory that bundler will
166 place cached gems in when running bundle package, and that bundler
167 will look in when installing gems. Defaults to vendor/bundle.
168
169 · clean (BUNDLE_CLEAN): Whether Bundler should run bundle clean auto‐
170 matically after bundle install.
171
172 · console (BUNDLE_CONSOLE): The console that bundle console starts.
173 Defaults to irb.
174
175 · default_install_uses_path (BUNDLE_DEFAULT_INSTALL_USES_PATH):
176 Whether a bundle install without an explicit --path argument
177 defaults to installing gems in .bundle.
178
179 · deployment (BUNDLE_DEPLOYMENT): Disallow changes to the Gemfile.
180 When the Gemfile is changed and the lockfile has not been updated,
181 running Bundler commands will be blocked.
182
183 · disable_checksum_validation (BUNDLE_DISABLE_CHECKSUM_VALIDATION):
184 Allow installing gems even if they do not match the checksum pro‐
185 vided by RubyGems.
186
187 · disable_exec_load (BUNDLE_DISABLE_EXEC_LOAD): Stop Bundler from
188 using load to launch an executable in-process in bundle exec.
189
190 · disable_local_branch_check (BUNDLE_DISABLE_LOCAL_BRANCH_CHECK):
191 Allow Bundler to use a local git override without a branch speci‐
192 fied in the Gemfile.
193
194 · disable_multisource (BUNDLE_DISABLE_MULTISOURCE): When set, Gem‐
195 files containing multiple sources will produce errors instead of
196 warnings. Use bundle config --delete disable_multisource to unset.
197
198 · disable_shared_gems (BUNDLE_DISABLE_SHARED_GEMS): Stop Bundler from
199 accessing gems installed to RubyGems´ normal location.
200
201 · disable_version_check (BUNDLE_DISABLE_VERSION_CHECK): Stop Bundler
202 from checking if a newer Bundler version is available on
203 rubygems.org.
204
205 · error_on_stderr (BUNDLE_ERROR_ON_STDERR): Print Bundler errors to
206 stderr.
207
208 · force_ruby_platform (BUNDLE_FORCE_RUBY_PLATFORM): Ignore the cur‐
209 rent machine´s platform and install only ruby platform gems. As a
210 result, gems with native extensions will be compiled from source.
211
212 · frozen (BUNDLE_FROZEN): Disallow changes to the Gemfile. When the
213 Gemfile is changed and the lockfile has not been updated, running
214 Bundler commands will be blocked. Defaults to true when --deploy‐
215 ment is used.
216
217 · gem.push_key (BUNDLE_GEM__PUSH_KEY): Sets the --key parameter for
218 gem push when using the rake release command with a private gem‐
219 stash server.
220
221 · gemfile (BUNDLE_GEMFILE): The name of the file that bundler should
222 use as the Gemfile. This location of this file also sets the root
223 of the project, which is used to resolve relative paths in the Gem‐
224 file, among other things. By default, bundler will search up from
225 the current working directory until it finds a Gemfile.
226
227 · global_gem_cache (BUNDLE_GLOBAL_GEM_CACHE): Whether Bundler should
228 cache all gems globally, rather than locally to the installing Ruby
229 installation.
230
231 · ignore_messages (BUNDLE_IGNORE_MESSAGES): When set, no post install
232 messages will be printed. To silence a single gem, use dot notation
233 like ignore_messages.httparty true.
234
235 · init_gems_rb (BUNDLE_INIT_GEMS_RB) Generate a gems.rb instead of a
236 Gemfile when running bundle init.
237
238 · jobs (BUNDLE_JOBS): The number of gems Bundler can install in par‐
239 allel. Defaults to 1.
240
241 · list_command (BUNDLE_LIST_COMMAND) Enable new list command feature
242
243 · major_deprecations (BUNDLE_MAJOR_DEPRECATIONS): Whether Bundler
244 should print deprecation warnings for behavior that will be changed
245 in the next major version.
246
247 · no_install (BUNDLE_NO_INSTALL): Whether bundle package should skip
248 installing gems.
249
250 · no_prune (BUNDLE_NO_PRUNE): Whether Bundler should leave outdated
251 gems unpruned when caching.
252
253 · only_update_to_newer_versions (BUNDLE_ONLY_UPDATE_TO_NEWER_VER‐
254 SIONS): During bundle update, only resolve to newer versions of the
255 gems in the lockfile.
256
257 · path (BUNDLE_PATH): The location on disk where all gems in your
258 bundle will be located regardless of $GEM_HOME or $GEM_PATH values.
259 Bundle gems not found in this location will be installed by bundle
260 install. Defaults to Gem.dir. When --deployment is used, defaults
261 to vendor/bundle.
262
263 · path.system (BUNDLE_PATH__SYSTEM): Whether Bundler will install
264 gems into the default system path (Gem.dir).
265
266 · plugins (BUNDLE_PLUGINS): Enable Bundler´s experimental plugin sys‐
267 tem.
268
269 · prefer_gems_rb (BUNDLE_PREFER_GEMS_RB) Prefer gems.rb to Gemfile
270 when Bundler is searching for a Gemfile.
271
272 · print_only_version_number (BUNDLE_PRINT_ONLY_VERSION_NUMBER) Print
273 only version number from bundler --version.
274
275 · redirect (BUNDLE_REDIRECT): The number of redirects allowed for
276 network requests. Defaults to 5.
277
278 · retry (BUNDLE_RETRY): The number of times to retry failed network
279 requests. Defaults to 3.
280
281 · setup_makes_kernel_gem_public (BUNDLE_SETUP_MAKES_KERNEL_GEM_PUB‐
282 LIC): Have Bundler.setup make the Kernel#gem method public, even
283 though RubyGems declares it as private.
284
285 · shebang (BUNDLE_SHEBANG): The program name that should be invoked
286 for generated binstubs. Defaults to the ruby install name used to
287 generate the binstub.
288
289 · silence_root_warning (BUNDLE_SILENCE_ROOT_WARNING): Silence the
290 warning Bundler prints when installing gems as root.
291
292 · skip_default_git_sources (BUNDLE_SKIP_DEFAULT_GIT_SOURCES): Whether
293 Bundler should skip adding default git source shortcuts to the Gem‐
294 file DSL.
295
296 · specific_platform (BUNDLE_SPECIFIC_PLATFORM): Allow bundler to
297 resolve for the specific running platform and store it in the lock‐
298 file, instead of only using a generic platform. A specific platform
299 is the exact platform triple reported by Gem::Platform.local, such
300 as x86_64-darwin-16 or universal-java-1.8. On the other hand,
301 generic platforms are those such as ruby, mswin, or java. In this
302 example, x86_64-darwin-16 would map to ruby and universal-java-1.8
303 to java.
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 · unlock_source_unlocks_spec (BUNDLE_UNLOCK_SOURCE_UNLOCKS_SPEC):
326 Whether running bundle update --source NAME unlocks a gem with the
327 given name. Defaults to true.
328
329 · update_requires_all_flag (BUNDLE_UPDATE_REQUIRES_ALL_FLAG) Require
330 passing --all to bundle update when everything should be updated,
331 and disallow passing no options to bundle update.
332
333 · user_agent (BUNDLE_USER_AGENT): The custom user agent fragment
334 Bundler includes in API requests.
335
336 · with (BUNDLE_WITH): A :-separated list of groups whose gems bundler
337 should install.
338
339 · without (BUNDLE_WITHOUT): A :-separated list of groups whose gems
340 bundler should not install.
341
342
343
344 In general, you should set these settings per-application by using the
345 applicable flag to the [bundle install(1)][bundle-install] or [bundle
346 package(1)][bundle-package] command.
347
348 You can set them globally either via environment variables or bundle
349 config, whichever is preferable for your setup. If you use both, envi‐
350 ronment variables will take preference over global settings.
351
353 Bundler also allows you to work against a git repository locally
354 instead of using the remote version. This can be achieved by setting up
355 a local override:
356
357
358
359 bundle config local.GEM_NAME /path/to/local/git/repository
360
361
362
363 For example, in order to use a local Rack repository, a developer could
364 call:
365
366
367
368 bundle config local.rack ~/Work/git/rack
369
370
371
372 Now instead of checking out the remote git repository, the local over‐
373 ride will be used. Similar to a path source, every time the local git
374 repository change, changes will be automatically picked up by Bundler.
375 This means a commit in the local git repo will update the revision in
376 the Gemfile.lock to the local git repo revision. This requires the same
377 attention as git submodules. Before pushing to the remote, you need to
378 ensure the local override was pushed, otherwise you may point to a com‐
379 mit that only exists in your local machine. You´ll also need to CGI
380 escape your usernames and passwords as well.
381
382 Bundler does many checks to ensure a developer won´t work with invalid
383 references. Particularly, we force a developer to specify a branch in
384 the Gemfile in order to use this feature. If the branch specified in
385 the Gemfile and the current branch in the local git repository do not
386 match, Bundler will abort. This ensures that a developer is always
387 working against the correct branches, and prevents accidental locking
388 to a different branch.
389
390 Finally, Bundler also ensures that the current revision in the Gem‐
391 file.lock exists in the local git repository. By doing this, Bundler
392 forces you to fetch the latest changes in the remotes.
393
395 Bundler supports overriding gem sources with mirrors. This allows you
396 to configure rubygems.org as the gem source in your Gemfile while still
397 using your mirror to fetch gems.
398
399
400
401 bundle config mirror.SOURCE_URL MIRROR_URL
402
403
404
405 For example, to use a mirror of rubygems.org hosted at rubygems-mir‐
406 ror.org:
407
408
409
410 bundle config mirror.http://rubygems.org http://rubygems-mirror.org
411
412
413
414 Each mirror also provides a fallback timeout setting. If the mirror
415 does not respond within the fallback timeout, Bundler will try to use
416 the original server instead of the mirror.
417
418
419
420 bundle config mirror.SOURCE_URL.fallback_timeout TIMEOUT
421
422
423
424 For example, to fall back to rubygems.org after 3 seconds:
425
426
427
428 bundle config mirror.https://rubygems.org.fallback_timeout 3
429
430
431
432 The default fallback timeout is 0.1 seconds, but the setting can cur‐
433 rently only accept whole seconds (for example, 1, 15, or 30).
434
436 Bundler allows you to configure credentials for any gem source, which
437 allows you to avoid putting secrets into your Gemfile.
438
439
440
441 bundle config SOURCE_HOSTNAME USERNAME:PASSWORD
442
443
444
445 For example, to save the credentials of user claudette for the gem
446 source at gems.longerous.com, you would run:
447
448
449
450 bundle config gems.longerous.com claudette:s00pers3krit
451
452
453
454 Or you can set the credentials as an environment variable like this:
455
456
457
458 export BUNDLE_GEMS__LONGEROUS__COM="claudette:s00pers3krit"
459
460
461
462 For gems with a git source with HTTP(S) URL you can specify credentials
463 like so:
464
465
466
467 bundle config https://github.com/bundler/bundler.git username:password
468
469
470
471 Or you can set the credentials as an environment variable like so:
472
473
474
475 export BUNDLE_GITHUB__COM=username:password
476
477
478
479 This is especially useful for private repositories on hosts such as
480 Github, where you can use personal OAuth tokens:
481
482
483
484 export BUNDLE_GITHUB__COM=abcd0123generatedtoken:x-oauth-basic
485
486
487
488
489
490
491 December 2017 BUNDLE-CONFIG(1)