1OPAM-CONFIG(1) Opam Manual OPAM-CONFIG(1)
2
3
4
6 opam-config - Display configuration options for packages.
7
9 opam config [OPTION]... [COMMAND] [ARG]...
10
12 This command uses opam state to output information on how to use
13 installed libraries, update the PATH, and substitute variables used in
14 opam packages.
15
16 Apart from opam config env, most of these commands are used by opam
17 internally, and are of limited interest for the casual user.
18
20 env Returns the bindings for the environment variables set in the
21 current switch, e.g. PATH, in a format intended to be evaluated by
22 a shell. With -v, add comments documenting the reason or package of
23 origin for each binding. This is most usefully used as eval $(opam
24 config env) to have further shell commands be evaluated in the
25 proper opam context. Can also be accessed through opam env.
26
27 revert-env
28 Reverts environment changes made by opam, e.g. eval $(opam config
29 revert-env) undoes what eval $(opam config env) did, as much as
30 possible.
31
32 list [PACKAGE]...
33 Without argument, prints a documented list of all available
34 variables. With PACKAGE, lists all the variables available for
35 these packages. Use - to include global configuration variables for
36 this switch.
37
38 expand STRING
39 Expand variable interpolations in the given string
40
41 subst FILE...
42 Substitute variables in the given files. The strings %{var}% are
43 replaced by the value of variable var (see var).
44
45 report
46 Prints a summary of your setup, useful for bug-reports.
47
48 cudf-universe [FILE]
49 Outputs the current available package universe in CUDF format.
50
51 pef-universe [FILE]
52 Outputs the current package universe in PEF format.
53
54 exec [--] COMMAND [ARG]...
55 Removed in 2.1, use opam exec instead.
56
57 set VAR VALUE
58 Removed in 2.1, use opam var instead.
59
60 unset VAR
61 Removed in 2.1, use opam var instead.
62
63 set-global VAR VALUE
64 Removed in 2.1, use opam var instead.
65
66 unset-global VAR
67 Removed in 2.1, use opam var instead.
68
69 var VAR
70 Removed in 2.1, use opam var instead.
71
73 --inplace-path
74 When updating the PATH variable, replace any pre-existing opam path
75 in-place rather than putting the new path in front. This means
76 programs installed in opam that were shadowed will remain so after
77 opam env
78
79 --no
80 Answer no to all opam yes/no questions without prompting. See also
81 --confirm-level. This is equivalent to setting $OPAMNO to "true".
82
83 --set-root
84 With the env and exec subcommands, also sets the OPAMROOT variable,
85 making sure further calls to opam will use the same root.
86
87 --set-switch
88 With the env and exec subcommands, also sets the OPAMSWITCH
89 variable, making sure further calls to opam will use the same
90 switch as this one.
91
92 --sexp
93 Print environment as an s-expression rather than in shell format
94
95 --shell=SHELL
96 Sets the configuration mode for opam environment appropriate for
97 SHELL. One of one of `bash', `sh', `csh', `zsh' or `fish'. Guessed
98 from the parent processes and the $SHELL variable by default.
99
100 -y, --yes
101 Answer yes to all opam yes/no questions without prompting. See also
102 --confirm-level. This is equivalent to setting $OPAMYES to "true".
103
105 These options are common to all commands.
106
107 --best-effort
108 Don't fail if all requested packages can't be installed: try to
109 install as many as possible. Note that not all external solvers may
110 support this option (recent versions of aspcud or mccs should).
111 This is equivalent to setting $OPAMBESTEFFORT environment variable.
112
113 --cli=MAJOR.MINOR (absent=2.1)
114 Use the command-line interface syntax and semantics of MAJOR.MINOR.
115 Intended for any persistent use of opam (scripts, blog posts,
116 etc.), any version of opam in the same MAJOR series will behave as
117 for the specified MINOR release. The flag was not available in opam
118 2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
119 to 2.0 instead of using this parameter.
120
121 --color=WHEN
122 Colorize the output. WHEN must be one of `always', `never' or
123 `auto'.
124
125 --confirm-level=LEVEL
126 Confirmation level, LEVEL must be one of `ask', `no', `yes' or
127 `unsafe-yes'. Can be specified more than once. If --yes or --no are
128 also given, the value of the last --confirm-level is taken into
129 account. This is equivalent to setting $OPAMCONFIRMLEVEL`.
130
131 --criteria=CRITERIA
132 Specify user preferences for dependency solving for this run.
133 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
134 on the supported language, and the external solvers available, see
135 http://opam.ocaml.org/doc/External_solvers.html. A general guide to
136 using solver preferences can be found at
137 http://www.dicosmo.org/Articles/usercriteria.pdf.
138
139 --cudf=FILENAME
140 Debug option: Save the CUDF requests sent to the solver to
141 FILENAME-<n>.cudf.
142
143 --debug
144 Print debug message to stderr. This is equivalent to setting
145 $OPAMDEBUG to "true".
146
147 --debug-level=LEVEL
148 Like --debug, but allows specifying the debug level (--debug sets
149 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
150
151 --git-version
152 Print the git version of opam, if set (i.e. you are using a
153 development version), and exit.
154
155 --help[=FMT] (default=auto)
156 Show this help in format FMT. The value FMT must be one of `auto',
157 `pager', `groff' or `plain'. With `auto', the format is `pager` or
158 `plain' whenever the TERM env var is `dumb' or undefined.
159
160 --ignore-pin-depends
161 Ignore extra pins required by packages that get pinned, either
162 manually through opam pin or through opam install DIR. This is
163 equivalent to setting IGNOREPINDEPENDS=true.
164
165 --json=FILENAME
166 Save the results of the opam run in a computer-readable file. If
167 the filename contains the character `%', it will be replaced by an
168 index that doesn't overwrite an existing file. Similar to setting
169 the $OPAMJSON variable.
170
171 --no-aspcud
172 Removed in 2.1.
173
174 --no-auto-upgrade
175 When configuring or updating a repository that is written for an
176 earlier opam version (1.2), opam internally converts it to the
177 current format. This disables this behaviour. Note that
178 repositories should define their format version in a 'repo' file at
179 their root, or they will be assumed to be in the older format. It
180 is, in any case, preferable to upgrade the repositories manually
181 using opam admin upgrade [--mirror URL] when possible.
182
183 --no-self-upgrade
184 Opam will replace itself with a newer binary found at OPAMROOT/opam
185 if present. This disables this behaviour.
186
187 -q, --quiet
188 Disables --verbose.
189
190 --root=ROOT
191 Use ROOT as the current root path. This is equivalent to setting
192 $OPAMROOT to ROOT.
193
194 --safe, --readonly
195 Make sure nothing will be automatically updated or rewritten.
196 Useful for calling from completion scripts, for example. Will fail
197 whenever such an operation is needed ; also avoids waiting for
198 locks, skips interactive questions and overrides the $OPAMDEBUG
199 variable. This is equivalent to set environment variable $OPAMSAFE.
200
201 --solver=CMD
202 Specify the CUDF solver to use for resolving package installation
203 problems. This is either a predefined solver (this version of opam
204 supports builtin-mccs+lp(), builtin-mccs+glpk,
205 builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
206 mccs, aspcud-old, packup), or a custom command that should contain
207 the variables %{input}%, %{output}%, %{criteria}%, and optionally
208 %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
209
210 --strict
211 Fail whenever an error is found in a package definition or a
212 configuration file. The default is to continue silently if
213 possible.
214
215 --switch=SWITCH
216 Use SWITCH as the current compiler switch. This is equivalent to
217 setting $OPAMSWITCH to SWITCH.
218
219 --use-internal-solver
220 Disable any external solver, and use the built-in one (this
221 requires that opam has been compiled with a built-in solver). This
222 is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
223
224 -v, --verbose
225 Be more verbose. One -v shows all package commands, repeat to also
226 display commands called internally (e.g. tar, curl, patch etc.)
227 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
228
229 --version
230 Show version information.
231
232 -w, --working-dir
233 Whenever updating packages that are bound to a local,
234 version-controlled directory, update to the current working state
235 of their source instead of the last committed state, or the ref
236 they are pointing to. As source directory is copied as it is, if it
237 isn't clean it may result on a opam build failure.This only affects
238 packages explicitly listed on the command-line.It can also be set
239 with $OPAMWORKINGDIR.
240
242 Opam makes use of the environment variables listed here. Boolean
243 variables should be set to "0", "no", "false" or the empty string to
244 disable, "1", "yes" or "true" to enable.
245
246 OPAMALLPARENS surround all filters with parenthesis.
247
248 OPAMASSUMEDEPEXTS see option `--assume-depexts'.
249
250 OPAMAUTOREMOVE see remove option `--auto-remove'.
251
252 OPAMBESTEFFORT see option `--best-effort'.
253
254 OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
255 the criteria when the `--best-effort' option is set, and is expected to
256 maximise the `opam-query' property in the solution.
257
258 OPAMBUILDDOC Removed in 2.1.
259
260 OPAMBUILDTEST Removed in 2.1.
261
262 OPAMCLI see option `--cli'.
263
264 OPAMCOLOR when set to always or never, sets a default value for the
265 `--color' option.
266
267 OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
268 priority over OPAMYES and OPAMNO.
269
270 OPAMCRITERIA specifies user preferences for dependency solving. The
271 default value depends on the solver version, use `config report' to
272 know the current setting. See also option --criteria.
273
274 OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
275
276 OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
277 preprocessing.
278
279 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
280 for more options.
281
282 OPAMDEBUG see options `--debug' and `--debug-level'.
283
284 OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
285 list of sections. Sections can optionally have a specific debug level
286 (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
287 `--debug-level'.
288
289 OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
290 CUDF preprocessing is.
291
292 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
293
294 OPAMDROPWORKINGDIR overrides packages previously updated with
295 --working-dir on update. Without this variable set, opam would keep
296 them unchanged unless explicitly named on the command-line.
297
298 OPAMDRYRUN see option `--dry-run'.
299
300 OPAMEDITOR sets the editor to use for opam file editing, overrides
301 $EDITOR and $VISUAL.
302
303 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
304 fails. 0 to print all.
305
306 OPAMEXTERNALSOLVER see option `--solver'.
307
308 OPAMFAKE see option `--fake'.
309
310 OPAMFETCH specifies how to download files: either `wget', `curl' or a
311 custom command where variables %{url}%, %{out}%, %{retry}%,
312 %{compress}% and %{checksum}% will be replaced. Overrides the
313 'download-command' value from the main config file.
314
315 OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
316
317 OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
318
319 OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
320
321 OPAMINPLACEBUILD see option `--inplace-build'.
322
323 OPAMJOBS sets the maximum number of parallel workers to run.
324
325 OPAMJSON log json output to the given file (use character `%' to index
326 the files).
327
328 OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
329
330 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
331 some backups. This skips some finalisers and may also help to get more
332 reliable backtraces.
333
334 OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
335
336 OPAMLOGS logdir sets log directory, default is a temporary directory in
337 /tmp
338
339 OPAMMAKECMD set the system make command to use.
340
341 OPAMMERGEOUT merge process outputs, stderr on stdout.
342
343 OPAMNO answer no to any question asked, see options `--no` and
344 `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
345 OPAMYES is set.
346
347 OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
348
349 OPAMNOASPCUD Deprecated.
350
351 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
352 in an earlier format to the current one, on 'update' or 'init'.
353
354 OPAMNOCHECKSUMS enables option --no-checksums when available.
355
356 OPAMNODEPEXTS disables system dependencies handling, see option
357 `--no-depexts'.
358
359 OPAMNOENVNOTICE Internal.
360
361 OPAMNOSELFUPGRADE see option `--no-self-upgrade'
362
363 OPAMPINKINDAUTO sets whether version control systems should be detected
364 when pinning to a local path. Enabled by default since 1.3.0.
365
366 OPAMPRECISETRACKING fine grain tracking of directories.
367
368 OPAMPREPRO set this to false to disable CUDF preprocessing. Less
369 efficient, but might help debugging solver issue.
370
371 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
372 available (e.g. for `opam install').
373
374 OPAMRETRIES sets the number of tries before failing downloads.
375
376 OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
377
378 OPAMROOT see option `--root'. This is automatically set by `opam env
379 --root=DIR --set-root'.
380
381 OPAMROOTISOK don't complain when running as root.
382
383 OPAMSAFE see option `--safe'.
384
385 OPAMSHOW see option `--show'.
386
387 OPAMSKIPUPDATE see option `--skip-updates'.
388
389 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
390 compatibility testing only.
391
392 OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
393 return a solution when they reach timeout; while the solution remains
394 assured to be consistent, there is no guarantee in this case that it
395 fits the expected optimisation criteria. If `true', opam willcontinue
396 with a warning, if `false' a timeout is an error. Currently only the
397 builtin-z3 backend handles this degraded case.
398
399 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
400 60.0, set to 0 for unlimited. Note that all solvers may not support
401 this option.
402
403 OPAMSTATS display stats at the end of command.
404
405 OPAMSTATUSLINE display a dynamic status line showing what's currently
406 going on on the terminal. (one of one of `always', `never' or `auto')
407
408 OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
409
410 OPAMSWITCH see option `--switch'. Automatically set by `opam env
411 --switch=SWITCH --set-switch'.
412
413 OPAMUNLOCKBASE see install option `--unlock-base'.
414
415 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
416 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
417 are set. See also option --criteria.
418
419 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
420
421 OPAMUSEOPENSSL force openssl use for hash computing.
422
423 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
424 or `auto'). By default `auto', which is determined from the locale).
425
426 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
427 Implies OPAMUTF8. This is set by default on OSX only.
428
429 OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
430 opam repository update.
431
432 OPAMVERBOSE see option `--verbose'.
433
434 OPAMVERSIONLAGPOWER do not use.
435
436 OPAMWITHDOC see install option `--with-doc'.
437
438 OPAMWITHTEST see install option `--with-test.
439
440 OPAMWORKINGDIR see option `--working-dir'.
441
442 OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
443 priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
444
445 OPAMVAR_var overrides the contents of the variable var when
446 substituting `%{var}%` strings in `opam` files.
447
448 OPAMVAR_package_var overrides the contents of the variable package:var
449 when substituting `%{package:var}%` strings in `opam` files.
450
452 All scripts and programmatic invocations of opam should use `--cli' in
453 order to ensure that they work seamlessly with future versions of the
454 opam client. Additionally, blog posts or other documentation can
455 benefit, as it prevents information from becoming stale.
456
457 Although opam only supports roots (~/.opam/) for the current version,
458 it does provide backwards compatibility for its command-line interface.
459
460 Since CLI version support was only added in opam 2.1, use OPAMCLI to
461 select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
462 for 2.1 (or later) versions, since an environment variable controlling
463 the parsing of syntax is brittle. To this end, opam displays a warning
464 if OPAMCLI specifies a valid version other than 2.0, and also if
465 `--cli=2.0' is specified.
466
467 The command-line version is selected by using the `--cli' option or the
468 OPAMCLI environment variable. `--cli' may be specified morethan once,
469 where the last instance takes precedence. OPAMCLI is only inspected if
470 `--cli' is not given.
471
473 As an exception to the following, the `exec' command returns 127 if the
474 command was not found or couldn't be executed, and the command's exit
475 value otherwise.
476
477 0 Success, or true for boolean queries.
478
479 1 False. Returned when a boolean return value is expected, e.g. when
480 running with --check, or for queries like opam lint.
481
482 2 Bad command-line arguments, or command-line arguments pointing to
483 an invalid context (e.g. file not following the expected format).
484
485 5 Not found. You requested something (package, version, repository,
486 etc.) that couldn't be found.
487
488 10 Aborted. The operation required confirmation, which wasn't given.
489
490 15 Could not acquire the locks required for the operation.
491
492 20 There is no solution to the user request. This can be caused by
493 asking to install two incompatible packages, for example.
494
495 30 Error in package definition, or other metadata files. Using
496 --strict raises this error more often.
497
498 31 Package script error. Some package operations were unsuccessful.
499 This may be an error in the packages or an incompatibility with
500 your system. This can be a partial error.
501
502 40 Sync error. Could not fetch some remotes from the network. This can
503 be a partial error.
504
505 50 Configuration error. Opam or system configuration doesn't allow
506 operation, and needs fixing.
507
508 60 Solver failure. The solver failed to return a sound answer. It can
509 be due to a broken external solver, or an error in solver
510 configuration.
511
512 99 Internal error. Something went wrong, likely due to a bug in opam
513 itself.
514
515 130 User interrupt. SIGINT was received, generally due to the user
516 pressing Ctrl-C.
517
519 See https://opam.ocaml.org/doc.
520
522 Vincent Bernardoff <vb@luminar.eu.org>
523 Raja Boujbel <raja.boujbel@ocamlpro.com>
524 Roberto Di Cosmo <roberto@dicosmo.org>
525 Thomas Gazagnaire <thomas@gazagnaire.org>
526 Louis Gesbert <louis.gesbert@ocamlpro.com>
527 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
528 Anil Madhavapeddy <anil@recoil.org>
529 Guillem Rieu <guillem.rieu@ocamlpro.com>
530 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
531 Frederic Tuong <tuong@users.gforge.inria.fr>
532
534 Check bug reports at https://github.com/ocaml/opam/issues.
535
536
537
538Opam 2.1.1 OPAM-CONFIG(1)