1OPAM-EXEC(1)                      Opam Manual                     OPAM-EXEC(1)
2
3
4

NAME

6       opam-exec - Executes a command in the proper opam environment
7

SYNOPSIS

9       opam exec [OPTION]... COMMAND [ARG]......
10

DESCRIPTION

12       Execute COMMAND with the correct environment variables. This command
13       can be used to cross-compile between switches using opam config exec
14       --switch=SWITCH -- COMMAND ARG1 ... ARGn. Opam expansion takes place in
15       command and args. If no switch is present on the command line or in the
16       OPAMSWITCH environment variable, OPAMSWITCH is not set in COMMAND's
17       environment.
18
19       This is a shortcut, and equivalent to opam config exec.
20

OPTIONS

22       --inplace-path
23           When updating the PATH variable, replace any pre-existing opam path
24           in-place rather than putting the new path in front. This means
25           programs installed in opam that were shadowed will remain so after
26           opam env
27
28       --no
29           Answer no to all opam yes/no questions without prompting. See also
30           --confirm-level. This is equivalent to setting $OPAMNO to "true".
31
32       --set-root
33           With the env and exec subcommands, also sets the OPAMROOT variable,
34           making sure further calls to opam will use the same root.
35
36       --set-switch
37           With the env and exec subcommands, also sets the OPAMSWITCH
38           variable, making sure further calls to opam will use the same
39           switch as this one.
40
41       -y, --yes
42           Answer yes to all opam yes/no questions without prompting. See also
43           --confirm-level. This is equivalent to setting $OPAMYES to "true".
44

COMMON OPTIONS

46       These options are common to all commands.
47
48       --best-effort
49           Don't fail if all requested packages can't be installed: try to
50           install as many as possible. Note that not all external solvers may
51           support this option (recent versions of aspcud or mccs should).
52           This is equivalent to setting $OPAMBESTEFFORT environment variable.
53
54       --cli=MAJOR.MINOR (absent=2.1)
55           Use the command-line interface syntax and semantics of MAJOR.MINOR.
56           Intended for any persistent use of opam (scripts, blog posts,
57           etc.), any version of opam in the same MAJOR series will behave as
58           for the specified MINOR release. The flag was not available in opam
59           2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
60           to 2.0 instead of using this parameter.
61
62       --color=WHEN
63           Colorize the output. WHEN must be one of `always', `never' or
64           `auto'.
65
66       --confirm-level=LEVEL
67           Confirmation level, LEVEL must be one of `ask', `no', `yes' or
68           `unsafe-yes'. Can be specified more than once. If --yes or --no are
69           also given, the value of the last --confirm-level is taken into
70           account. This is equivalent to setting  $OPAMCONFIRMLEVEL`.
71
72       --criteria=CRITERIA
73           Specify user preferences for dependency solving for this run.
74           Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
75           on the supported language, and the external solvers available, see
76           http://opam.ocaml.org/doc/External_solvers.html. A general guide to
77           using solver preferences can be found at
78           http://www.dicosmo.org/Articles/usercriteria.pdf.
79
80       --cudf=FILENAME
81           Debug option: Save the CUDF requests sent to the solver to
82           FILENAME-<n>.cudf.
83
84       --debug
85           Print debug message to stderr. This is equivalent to setting
86           $OPAMDEBUG to "true".
87
88       --debug-level=LEVEL
89           Like --debug, but allows specifying the debug level (--debug sets
90           it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
91
92       --git-version
93           Print the git version of opam, if set (i.e. you are using a
94           development version), and exit.
95
96       --help[=FMT] (default=auto)
97           Show this help in format FMT. The value FMT must be one of `auto',
98           `pager', `groff' or `plain'. With `auto', the format is `pager` or
99           `plain' whenever the TERM env var is `dumb' or undefined.
100
101       --ignore-pin-depends
102           Ignore extra pins required by packages that get pinned, either
103           manually through opam pin or through opam install DIR. This is
104           equivalent to setting IGNOREPINDEPENDS=true.
105
106       --json=FILENAME
107           Save the results of the opam run in a computer-readable file. If
108           the filename contains the character `%', it will be replaced by an
109           index that doesn't overwrite an existing file. Similar to setting
110           the $OPAMJSON variable.
111
112       --no-aspcud
113           Removed in 2.1.
114
115       --no-auto-upgrade
116           When configuring or updating a repository that is written for an
117           earlier opam version (1.2), opam internally converts it to the
118           current format. This disables this behaviour. Note that
119           repositories should define their format version in a 'repo' file at
120           their root, or they will be assumed to be in the older format. It
121           is, in any case, preferable to upgrade the repositories manually
122           using opam admin upgrade [--mirror URL] when possible.
123
124       --no-self-upgrade
125           Opam will replace itself with a newer binary found at OPAMROOT/opam
126           if present. This disables this behaviour.
127
128       -q, --quiet
129           Disables --verbose.
130
131       --root=ROOT
132           Use ROOT as the current root path. This is equivalent to setting
133           $OPAMROOT to ROOT.
134
135       --safe, --readonly
136           Make sure nothing will be automatically updated or rewritten.
137           Useful for calling from completion scripts, for example. Will fail
138           whenever such an operation is needed ; also avoids waiting for
139           locks, skips interactive questions and overrides the $OPAMDEBUG
140           variable. This is equivalent to set environment variable $OPAMSAFE.
141
142       --solver=CMD
143           Specify the CUDF solver to use for resolving package installation
144           problems. This is either a predefined solver (this version of opam
145           supports builtin-mccs+lp(), builtin-mccs+glpk,
146           builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
147           mccs, aspcud-old, packup), or a custom command that should contain
148           the variables %{input}%, %{output}%, %{criteria}%, and optionally
149           %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
150
151       --strict
152           Fail whenever an error is found in a package definition or a
153           configuration file. The default is to continue silently if
154           possible.
155
156       --switch=SWITCH
157           Use SWITCH as the current compiler switch. This is equivalent to
158           setting $OPAMSWITCH to SWITCH.
159
160       --use-internal-solver
161           Disable any external solver, and use the built-in one (this
162           requires that opam has been compiled with a built-in solver). This
163           is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
164
165       -v, --verbose
166           Be more verbose. One -v shows all package commands, repeat to also
167           display commands called internally (e.g. tar, curl, patch etc.)
168           Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
169
170       --version
171           Show version information.
172
173       -w, --working-dir
174           Whenever updating packages that are bound to a local,
175           version-controlled directory, update to the current working state
176           of their source instead of the last committed state, or the ref
177           they are pointing to. As source directory is copied as it is, if it
178           isn't clean it may result on a opam build failure.This only affects
179           packages explicitly listed on the command-line.It can also be set
180           with $OPAMWORKINGDIR.
181

ENVIRONMENT

183       Opam makes use of the environment variables listed here. Boolean
184       variables should be set to "0", "no", "false" or the empty string to
185       disable, "1", "yes" or "true" to enable.
186
187       OPAMALLPARENS surround all filters with parenthesis.
188
189       OPAMASSUMEDEPEXTS see option `--assume-depexts'.
190
191       OPAMAUTOREMOVE see remove option `--auto-remove'.
192
193       OPAMBESTEFFORT see option `--best-effort'.
194
195       OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
196       the criteria when the `--best-effort' option is set, and is expected to
197       maximise the `opam-query' property in the solution.
198
199       OPAMBUILDDOC Removed in 2.1.
200
201       OPAMBUILDTEST Removed in 2.1.
202
203       OPAMCLI see option `--cli'.
204
205       OPAMCOLOR when set to always or never, sets a default value for the
206       `--color' option.
207
208       OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
209       priority over OPAMYES and OPAMNO.
210
211       OPAMCRITERIA specifies user preferences for dependency solving. The
212       default value depends on the solver version, use `config report' to
213       know the current setting. See also option --criteria.
214
215       OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
216
217       OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
218       preprocessing.
219
220       OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
221       for more options.
222
223       OPAMDEBUG see options `--debug' and `--debug-level'.
224
225       OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
226       list of sections. Sections can optionally have a specific debug level
227       (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
228       `--debug-level'.
229
230       OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
231       CUDF preprocessing is.
232
233       OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
234
235       OPAMDROPWORKINGDIR overrides packages previously updated with
236       --working-dir on update. Without this variable set, opam would keep
237       them unchanged unless explicitly named on the command-line.
238
239       OPAMDRYRUN see option `--dry-run'.
240
241       OPAMEDITOR sets the editor to use for opam file editing, overrides
242       $EDITOR and $VISUAL.
243
244       OPAMERRLOGLEN sets the number of log lines printed when a sub-process
245       fails. 0 to print all.
246
247       OPAMEXTERNALSOLVER see option `--solver'.
248
249       OPAMFAKE see option `--fake'.
250
251       OPAMFETCH specifies how to download files: either `wget', `curl' or a
252       custom command where variables %{url}%, %{out}%, %{retry}%,
253       %{compress}% and %{checksum}% will be replaced. Overrides the
254       'download-command' value from the main config file.
255
256       OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
257
258       OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
259
260       OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
261
262       OPAMINPLACEBUILD see option `--inplace-build'.
263
264       OPAMJOBS sets the maximum number of parallel workers to run.
265
266       OPAMJSON log json output to the given file (use character `%' to index
267       the files).
268
269       OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
270
271       OPAMKEEPLOGS tells opam to not remove some temporary command logs and
272       some backups. This skips some finalisers and may also help to get more
273       reliable backtraces.
274
275       OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
276
277       OPAMLOGS logdir sets log directory, default is a temporary directory in
278       /tmp
279
280       OPAMMAKECMD set the system make command to use.
281
282       OPAMMERGEOUT merge process outputs, stderr on stdout.
283
284       OPAMNO answer no to any question asked, see options `--no` and
285       `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
286       OPAMYES is set.
287
288       OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
289
290       OPAMNOASPCUD Deprecated.
291
292       OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
293       in an earlier format to the current one, on 'update' or 'init'.
294
295       OPAMNOCHECKSUMS enables option --no-checksums when available.
296
297       OPAMNODEPEXTS disables system dependencies handling, see option
298       `--no-depexts'.
299
300       OPAMNOENVNOTICE Internal.
301
302       OPAMNOSELFUPGRADE see option `--no-self-upgrade'
303
304       OPAMPINKINDAUTO sets whether version control systems should be detected
305       when pinning to a local path. Enabled by default since 1.3.0.
306
307       OPAMPRECISETRACKING fine grain tracking of directories.
308
309       OPAMPREPRO set this to false to disable CUDF preprocessing. Less
310       efficient, but might help debugging solver issue.
311
312       OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
313       available (e.g. for `opam install').
314
315       OPAMRETRIES sets the number of tries before failing downloads.
316
317       OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
318
319       OPAMROOT see option `--root'. This is automatically set by `opam env
320       --root=DIR --set-root'.
321
322       OPAMROOTISOK don't complain when running as root.
323
324       OPAMSAFE see option `--safe'.
325
326       OPAMSHOW see option `--show'.
327
328       OPAMSKIPUPDATE see option `--skip-updates'.
329
330       OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
331       compatibility testing only.
332
333       OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
334       return a solution when they reach timeout; while the solution remains
335       assured to be consistent, there is no guarantee in this case that it
336       fits the expected optimisation criteria. If `true', opam willcontinue
337       with a warning, if `false' a timeout is an error. Currently only the
338       builtin-z3 backend handles this degraded case.
339
340       OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
341       60.0, set to 0 for unlimited. Note that all solvers may not support
342       this option.
343
344       OPAMSTATS display stats at the end of command.
345
346       OPAMSTATUSLINE display a dynamic status line showing what's currently
347       going on on the terminal. (one of one of `always', `never' or `auto')
348
349       OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
350
351       OPAMSWITCH see option `--switch'. Automatically set by `opam env
352       --switch=SWITCH --set-switch'.
353
354       OPAMUNLOCKBASE see install option `--unlock-base'.
355
356       OPAMUPGRADECRITERIA specifies user preferences for dependency solving
357       when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
358       are set. See also option --criteria.
359
360       OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
361
362       OPAMUSEOPENSSL force openssl use for hash computing.
363
364       OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
365       or `auto'). By default `auto', which is determined from the locale).
366
367       OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
368       Implies OPAMUTF8. This is set by default on OSX only.
369
370       OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
371       opam repository update.
372
373       OPAMVERBOSE see option `--verbose'.
374
375       OPAMVERSIONLAGPOWER do not use.
376
377       OPAMWITHDOC see install option `--with-doc'.
378
379       OPAMWITHTEST see install option `--with-test.
380
381       OPAMWORKINGDIR see option `--working-dir'.
382
383       OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
384       priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
385
386       OPAMVAR_var overrides the contents of the variable var when
387       substituting `%{var}%` strings in `opam` files.
388
389       OPAMVAR_package_var overrides the contents of the variable package:var
390       when substituting `%{package:var}%` strings in `opam` files.
391

CLI VERSION

393       All scripts and programmatic invocations of opam should use `--cli' in
394       order to ensure that they work seamlessly with future versions of the
395       opam client. Additionally, blog posts or other documentation can
396       benefit, as it prevents information from becoming stale.
397
398       Although opam only supports roots (~/.opam/) for the current version,
399       it does provide backwards compatibility for its command-line interface.
400
401       Since CLI version support was only added in opam 2.1, use OPAMCLI to
402       select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
403       for 2.1 (or later) versions, since an environment variable controlling
404       the parsing of syntax is brittle. To this end, opam displays a warning
405       if OPAMCLI specifies a valid version other than 2.0, and also if
406       `--cli=2.0' is specified.
407
408       The command-line version is selected by using the `--cli' option or the
409       OPAMCLI environment variable. `--cli' may be specified morethan once,
410       where the last instance takes precedence. OPAMCLI is only inspected if
411       `--cli' is not given.
412

EXIT STATUS

414       As an exception to the following, the `exec' command returns 127 if the
415       command was not found or couldn't be executed, and the command's exit
416       value otherwise.
417
418       0   Success, or true for boolean queries.
419
420       1   False. Returned when a boolean return value is expected, e.g. when
421           running with --check, or for queries like opam lint.
422
423       2   Bad command-line arguments, or command-line arguments pointing to
424           an invalid context (e.g. file not following the expected format).
425
426       5   Not found. You requested something (package, version, repository,
427           etc.) that couldn't be found.
428
429       10  Aborted. The operation required confirmation, which wasn't given.
430
431       15  Could not acquire the locks required for the operation.
432
433       20  There is no solution to the user request. This can be caused by
434           asking to install two incompatible packages, for example.
435
436       30  Error in package definition, or other metadata files. Using
437           --strict raises this error more often.
438
439       31  Package script error. Some package operations were unsuccessful.
440           This may be an error in the packages or an incompatibility with
441           your system. This can be a partial error.
442
443       40  Sync error. Could not fetch some remotes from the network. This can
444           be a partial error.
445
446       50  Configuration error. Opam or system configuration doesn't allow
447           operation, and needs fixing.
448
449       60  Solver failure. The solver failed to return a sound answer. It can
450           be due to a broken external solver, or an error in solver
451           configuration.
452
453       99  Internal error. Something went wrong, likely due to a bug in opam
454           itself.
455
456       130 User interrupt. SIGINT was received, generally due to the user
457           pressing Ctrl-C.
458

FURTHER DOCUMENTATION

460       See https://opam.ocaml.org/doc.
461

AUTHORS

463       Vincent Bernardoff <vb@luminar.eu.org>
464       Raja Boujbel <raja.boujbel@ocamlpro.com>
465       Roberto Di Cosmo <roberto@dicosmo.org>
466       Thomas Gazagnaire <thomas@gazagnaire.org>
467       Louis Gesbert <louis.gesbert@ocamlpro.com>
468       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
469       Anil Madhavapeddy <anil@recoil.org>
470       Guillem Rieu <guillem.rieu@ocamlpro.com>
471       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
472       Frederic Tuong <tuong@users.gforge.inria.fr>
473

BUGS

475       Check bug reports at https://github.com/ocaml/opam/issues.
476
477
478
479Opam 2.1.2                                                        OPAM-EXEC(1)
Impressum