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

ENVIRONMENT VARIABLES

162       Opam makes use of the environment variables listed here. Boolean
163       variables should be set to "0", "no", "false" or the empty string to
164       disable, "1", "yes" or "true" to enable.
165
166       OPAMALLPARENS surround all filters with parenthesis
167
168       OPAMAUTOREMOVE see remove option `--auto-remove`
169
170       OPAMBESTEFFORT see option `--best-effort`
171
172       OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
173       the criteria when the `--best-effort` option is set, and is expected to
174       maximise the `opam-query` property in the solution
175
176       OPAMCOLOR, when set to always or never, sets a default value for the
177       --color option.
178
179       OPAMCRITERIA specifies user preferences for dependency solving. The
180       default value depends on the solver version, use `config report` to
181       know the current setting. See also option --criteria
182
183       OPAMCUDFFILE file save the cudf graph to file-actions-explicit.dot
184
185       OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
186       for more options.
187
188       OPAMDEBUG see options `--debug' and `--debug-level'.
189
190       OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
191
192       OPAMDRYRUN see option `--dry-run`
193
194       OPAMEDITOR sets the editor to use for opam file editing, overrides
195       $EDITOR and $VISUAL
196
197       OPAMERRLOGLEN sets the number of log lines printed when a sub-process
198       fails. 0 to print all.
199
200       OPAMEXTERNALSOLVER see option `--solver'.
201
202       OPAMFAKE see option `--fake`
203
204       OPAMFETCH specifies how to download files: either `wget', `curl' or a
205       custom command where variables %{url}%, %{out}%, %{retry}%,
206       %{compress}% and %{checksum}% will be replaced. Overrides the
207       'download-command' value from the main config file.
208
209       OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup
210
211       OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on`
212
213       OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends`
214
215       OPAMJOBS sets the maximum number of parallel workers to run.
216
217       OPAMJSON log json output to the given file (use character `%' to index
218       the files)
219
220       OPAMLOCKED see install option `--locked`
221
222       OPAMLOGS logdir sets log directory, default is a temporary directory in
223       /tmp
224
225       OPAMMAKECMD set the system make command to use
226
227       OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
228       in an earlier format to the current one, on 'update' or 'init'.
229
230       OPAMKEEPLOGS tells opam to not remove some temporary command logs and
231       some backups. This skips some finalisers and may also help to get more
232       reliable backtraces
233
234       OPAMLOCKRETRIES sets the number of tries after which opam gives up
235       acquiring its lock and fails. <= 0 means infinite wait.
236
237       OPAMMERGEOUT merge process outputs, stderr on stdout
238
239       OPAMNO answer no to any question asked.
240
241       OPAMNOASPCUD Deprecated.
242
243       OPAMNOCHECKSUMS enables option --no-checksums when available.
244
245       OPAMNOSELFUPGRADE see option `--no-self-upgrade'.
246
247       OPAMPINKINDAUTO sets whether version control systems should be detected
248       when pinning to a local path. Enabled by default since 1.3.0.
249
250       OPAMPRECISETRACKING fine grain tracking of directories
251
252       OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
253       available (e.g. for `opam install`).
254
255       OPAMRETRES sets the number of tries before failing downloads.
256
257       OPAMROOT see option `--root'. This is automatically set by `opam env
258       --root=DIR --set-root'.
259
260       OPAMROOTISOK don't complain when running as root.
261
262       OPAMSAFE see option `--safe'
263
264       OPAMSHOW see option `--show`
265
266       OPAMSKIPUPDATE see option `--skip-updates`
267
268       OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
269       compatibility testing only.
270
271       OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
272       60.0, set to 0 for unlimited. Note that all solvers may not support
273       this option.
274
275       OPAMSTATUSLINE display a dynamic status line showing what's currently
276       going on on the terminal. (one of one of `always', `never' or `auto')
277
278       OPAMSTATS display stats at the end of command
279
280       OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.)
281
282       OPAMSWITCH see option `--switch'. Automatically set by `opam env
283       --switch=SWITCH --set-switch'.
284
285       OPAMUNLOCKBASE see install option `--unlock-base`
286
287       OPAMUPGRADECRITERIA specifies user preferences for dependency solving
288       when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
289       are set. See also option --criteria
290
291       OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
292
293       OPAMUSEOPENSSL force openssl use for hash computing
294
295       OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
296       or `auto'). By default `auto', which is determined from the locale).
297
298       OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
299       Implies OPAMUTF8. This is set by default on OSX only.
300
301       OPAMVALIDATIONHOOK hook if set, uses the `%{hook%}` command to validate
302       an opam repository update
303
304       OPAMVAR_var overrides the contents of the variable var when
305       substituting `%{var}%` strings in `opam` files.
306
307       OPAMVAR_package_var overrides the contents of the variable package:var
308       when substituting `%{package:var}%` strings in `opam` files.
309
310       OPAMVERBOSE see option `--verbose'.
311
312       OPAMWORKINGDIR see option `--working-dir`
313
314       OPAMYES see option `--yes'.
315

EXIT STATUS

317       As an exception to the following, the `exec' command returns 127 if the
318       command was not found or couldn't be executed, and the command's exit
319       value otherwise.
320
321       0   Success, or true for boolean queries.
322
323       1   False. Returned when a boolean return value is expected, e.g. when
324           running with --check, or for queries like opam lint.
325
326       2   Bad command-line arguments, or command-line arguments pointing to
327           an invalid context (e.g. file not following the expected format).
328
329       5   Not found. You requested something (package, version, repository,
330           etc.) that couldn't be found.
331
332       10  Aborted. The operation required confirmation, which wasn't given.
333
334       15  Could not acquire the locks required for the operation.
335
336       20  There is no solution to the user request. This can be caused by
337           asking to install two incompatible packages, for example.
338
339       30  Error in package definition, or other metadata files. Using
340           --strict raises this error more often.
341
342       31  Package script error. Some package operations were unsuccessful.
343           This may be an error in the packages or an incompatibility with
344           your system. This can be a partial error.
345
346       40  Sync error. Could not fetch some remotes from the network. This can
347           be a partial error.
348
349       50  Configuration error. Opam or system configuration doesn't allow
350           operation, and needs fixing.
351
352       60  Solver failure. The solver failed to return a sound answer. It can
353           be due to a broken external solver, or an error in solver
354           configuration.
355
356       99  Internal error. Something went wrong, likely due to a bug in opam
357           itself.
358
359       130 User interrupt. SIGINT was received, generally due to the user
360           pressing Ctrl-C.
361

FURTHER DOCUMENTATION

363       See https://opam.ocaml.org/doc.
364

AUTHORS

366       Vincent Bernardoff <vb@luminar.eu.org>
367       Raja Boujbel <raja.boujbel@ocamlpro.com>
368       Roberto Di Cosmo <roberto@dicosmo.org>
369       Thomas Gazagnaire <thomas@gazagnaire.org>
370       Louis Gesbert <louis.gesbert@ocamlpro.com>
371       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
372       Anil Madhavapeddy <anil@recoil.org>
373       Guillem Rieu <guillem.rieu@ocamlpro.com>
374       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
375       Frederic Tuong <tuong@users.gforge.inria.fr>
376

BUGS

378       Check bug reports at https://github.com/ocaml/opam/issues.
379
380
381
382Opam 2.0.4                                                        OPAM-EXEC(1)
Impressum