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