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       --set-root
29           With the env and exec subcommands, also sets the OPAMROOT variable,
30           making sure further calls to opam will use the same root.
31
32       --set-switch
33           With the env and exec subcommands, also sets the OPAMSWITCH
34           variable, making sure further calls to opam will use the same
35           switch as this one.
36

COMMON OPTIONS

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

ENVIRONMENT VARIABLES

157       Opam makes use of the environment variables listed here. Boolean
158       variables should be set to "0", "no", "false" or the empty string to
159       disable, "1", "yes" or "true" to enable.
160
161       OPAMCOLOR, when set to always or never, sets a default value for the
162       --color option.
163
164       OPAMCRITERIA specifies user preferences for dependency solving. The
165       default value depends on the solver version, use `config report` to
166       know the current setting. See also option --criteria
167
168       OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
169       for more options.
170
171       OPAMDEBUG see options `--debug' and `--debug-level'.
172
173       OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
174
175       OPAMERRLOGLEN sets the number of log lines printed when a sub-process
176       fails. 0 to print all.
177
178       OPAMEXTERNALSOLVER see option `--solver'.
179
180       OPAMFETCH specifies how to download files: either `wget', `curl' or a
181       custom command where variables %{url}%, %{out}%, %{retry}%,
182       %{compress}% and %{checksum}% will be replaced. Overrides the
183       'download-command' value from the main config file.
184
185       OPAMJOBS sets the maximum number of parallel workers to run.
186
187       OPAMJSON log json output to the given file (use character `%' to index
188       the files)
189
190       OPAMLOCK see option `--lock'.
191
192       OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
193       in an earlier format to the current one, on 'update' or 'init'.
194
195       OPAMKEEPLOGS tells opam to not remove some temporary command logs and
196       some backups. This skips some finalisers and may also help to get more
197       reliable backtraces
198
199       OPAMLOCKRETRIES sets the number of tries after which OPAM gives up
200       acquiring its lock and fails. <= 0 means infinite wait.
201
202       OPAMNO answer no to any question asked.
203
204       OPAMNOASPCUD see option `--no-aspcud'.
205
206       OPAMNOSELFUPGRADE see option `--no-self-upgrade'.
207
208       OPAMPINKINDAUTO sets whether version control systems should be detected
209       when pinning to a local path. Enabled by default since 1.3.0.
210
211       OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
212       available (e.g. for `opam install`).
213
214       OPAMRETRY sets the number of tries before failing downloads.
215
216       OPAMROOT see option `--root'. This is automatically set by `opam env
217       --root=DIR --set-root'.
218
219       OPAMROOTISOK don't complain when running as root.
220
221       OPAMSAFE see option `--safe'
222
223       OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
224       compatibility testing only.
225
226       OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
227       60.0, set to 0 for unlimited. Note that all solvers may not support
228       this option.
229
230       OPAMSTATUSLINE display a dynamic status line showing what's currently
231       going on on the terminal. (one of one of `always', `never' or `auto')
232
233       OPAMSWITCH see option `--switch'. Automatically set by `opam env
234       --switch=SWITCH --set-switch'.
235
236       OPAMUPGRADECRITERIA specifies user preferences for dependency solving
237       when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
238       are set. See also option --criteria
239
240       OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
241
242       OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
243       or `auto'). By default `auto', which is determined from the locale).
244
245       OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
246       Implies OPAMUTF8. This is set by default on OSX only.
247
248       OPAMVAR_var overrides the contents of the variable var when
249       substituting `%{var}%` strings in `opam` files.
250
251       OPAMVAR_package_var overrides the contents of the variable package:var
252       when substituting `%{package:var}%` strings in `opam` files.
253
254       OPAMVERBOSE see option `--verbose'.
255
256       OPAMYES see option `--yes'.
257

EXIT STATUS

259       As an exception to the following, the `exec' command returns 127 if the
260       command was not found or couldn't be executed, and the command's exit
261       value otherwise.
262
263       0   Success, or true for boolean queries.
264
265       1   False. Returned when a boolean return value is expected, e.g. when
266           running with --check, or for queries like opam lint.
267
268       2   Bad command-line arguments, or command-line arguments pointing to
269           an invalid context (e.g. file not following the expected format).
270
271       5   Not found. You requested something (package, version, repository,
272           etc.) that couldn't be found.
273
274       10  Aborted. The operation required confirmation, which wasn't given.
275
276       15  Could not acquire the locks required for the operation.
277
278       20  There is no solution to the user request. This can be caused by
279           asking to install two incompatible packages, for example.
280
281       30  Error in package definition, or other metadata files. Using
282           --strict raises this error more often.
283
284       31  Package script error. Some package operations were unsuccessful.
285           This may be an error in the packages or an incompatibility with
286           your system. This can be a partial error.
287
288       40  Sync error. Could not fetch some remotes from the network. This can
289           be a partial error.
290
291       50  Configuration error. Opam or system configuration doesn't allow
292           operation, and needs fixing.
293
294       60  Solver failure. The solver failed to return a sound answer. It can
295           be due to a broken external solver, or an error in solver
296           configuration.
297
298       99  Internal error. Something went wrong, likely due to a bug in opam
299           itself.
300
301       130 User interrupt. SIGINT was received, generally due to the user
302           pressing Ctrl-C.
303

FURTHER DOCUMENTATION

305       See https://opam.ocaml.org/doc.
306

AUTHORS

308       Vincent Bernardoff <vb@luminar.eu.org>
309       Raja Boujbel <raja.boujbel@ocamlpro.com>
310       Roberto Di Cosmo <roberto@dicosmo.org>
311       Thomas Gazagnaire <thomas@gazagnaire.org>
312       Louis Gesbert <louis.gesbert@ocamlpro.com>
313       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
314       Anil Madhavapeddy <anil@recoil.org>
315       Guillem Rieu <guillem.rieu@ocamlpro.com>
316       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
317       Frederic Tuong <tuong@users.gforge.inria.fr>
318

BUGS

320       Check bug reports at https://github.com/ocaml/opam/issues.
321
322
323
324Opam 2.0.1                                                        opam-exec(1)
Impressum