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