opam-exec - Executes a command in the proper opam environment
opam exec [OPTION]... COMMAND [ARG]......
Execute COMMAND with the correct environment variables. This command can be used to cross-compile between switches using opam config exec --switch=SWITCH -- COMMAND ARG1 ... ARGn. Opam expansion takes place in command and args. If no switch is present on the command line or in the OPAMSWITCH environment variable, OPAMSWITCH is not set in COMMAND's environment.
This is a shortcut, and equivalent to opam config exec.
These options are common to all commands.
Opam makes use of the environment variables listed here. Boolean variables should be set to "0", "no", "false" or the empty string to disable, "1", "yes" or "true" to enable.
OPAMALLPARENS surround all filters with parenthesis
OPAMAUTOREMOVE see remove option `--auto-remove`
OPAMBESTEFFORT see option `--best-effort`
OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to the criteria when the `--best-effort` option is set, and is expected to maximise the `opam-query` property in the solution
OPAMCLI see option `--cli'
OPAMCOLOR, when set to always or never, sets a default value for the --color option.
OPAMCRITERIA specifies user preferences for dependency solving. The default value depends on the solver version, use `config report` to know the current setting. See also option --criteria
OPAMCUDFFILE file save the cudf graph to file-actions-explicit.dot
OPAMDEPEXTYES launch system package managers in non-interactive mode
OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH for more options.
OPAMDEBUG see options `--debug' and `--debug-level'.
OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated list of sections. Sections can optionally have a specific debug level (for example, CLIENT:2 or CLIENT CUDF:2, but otherwise use `--debug-level'.
OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
OPAMDRYRUN see option `--dry-run`
OPAMEDITOR sets the editor to use for opam file editing, overrides $EDITOR and $VISUAL
OPAMERRLOGLEN sets the number of log lines printed when a sub-process fails. 0 to print all.
OPAMEXTERNALSOLVER see option `--solver'.
OPAMFAKE see option `--fake`
OPAMFETCH specifies how to download files: either `wget', `curl' or a custom command where variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% will be replaced. Overrides the 'download-command' value from the main config file.
OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup
OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on`
OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends`
OPAMJOBS sets the maximum number of parallel workers to run.
OPAMJSON log json output to the given file (use character `%' to index the files)
OPAMLOCKED combination of `--locked` and `--lock-suffix` options
OPAMLOGS logdir sets log directory, default is a temporary directory in /tmp
OPAMMAKECMD set the system make command to use
OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories in an earlier format to the current one, on 'update' or 'init'.
OPAMKEEPLOGS tells opam to not remove some temporary command logs and some backups. This skips some finalisers and may also help to get more reliable backtraces
OPAMLOCKRETRIES sets the number of tries after which opam gives up acquiring its lock and fails. <= 0 means infinite wait.
OPAMMERGEOUT merge process outputs, stderr on stdout
OPAMNO answer no to any question asked.
OPAMNOASPCUD Deprecated.
OPAMNOCHECKSUMS enables option --no-checksums when available.
OPAMDROPWORKINGDIR overrides packages previously updated with --working-dir on update. Without this variable set, opam would keep them unchanged unless explicitely named on the command-line.
OPAMNOSELFUPGRADE see option `--no-self-upgrade'.
OPAMPINKINDAUTO sets whether version control systems should be detected when pinning to a local path. Enabled by default since 1.3.0.
OPAMPRECISETRACKING fine grain tracking of directories
OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when available (e.g. for `opam install`).
OPAMRETRIES sets the number of tries before failing downloads.
OPAMROOT see option `--root'. This is automatically set by `opam env --root=DIR --set-root'.
OPAMROOTISOK don't complain when running as root.
OPAMSAFE see option `--safe'
OPAMSHOW see option `--show`
OPAMSKIPUPDATE see option `--skip-updates`
OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for compatibility testing only.
OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is 60.0, set to 0 for unlimited. Note that all solvers may not support this option.
OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still return a solution when they reach timeout; while the solution remains assured to be consistent, there is no guarantee in this case that it fits the expected optimisation criteria. If `true', opam will continue with a warning, if `false' a timeout is an error. Currently only the builtin-z3 backend handles this degraded case.
OPAMSTATUSLINE display a dynamic status line showing what's currently going on on the terminal. (one of one of `always', `never' or `auto')
OPAMSTATS display stats at the end of command
OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.)
OPAMSWITCH see option `--switch'. Automatically set by `opam env --switch=SWITCH --set-switch'.
OPAMUNLOCKBASE see install option `--unlock-base`
OPAMUPGRADECRITERIA specifies user preferences for dependency solving when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both are set. See also option --criteria
OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
OPAMUSEOPENSSL force openssl use for hash computing
OPAMUTF8 use UTF8 characters in output (one of one of `always', `never' or `auto'). By default `auto', which is determined from the locale).
OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages. Implies OPAMUTF8. This is set by default on OSX only.
OPAMVALIDATIONHOOK hook if set, uses the `%{hook%}` command to validate an opam repository update
OPAMVAR_var overrides the contents of the variable var when substituting `%{var}%` strings in `opam` files.
OPAMVAR_package_var overrides the contents of the variable package:var when substituting `%{package:var}%` strings in `opam` files.
OPAMVERBOSE see option `--verbose'.
OPAMWORKINGDIR see option `--working-dir`
All scripts and programmatic invocations of opam should use `--cli' in order to ensure that they work seamlessly with future versions of the opam client. Additionally, blog posts or other documentation can benefit, as it prevents information from becoming stale.
Although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface.
The command-line version is selected by using the `--cli' option or the OPAMCLI environment variable. `--cli' may be specified more than once, where the last instance takes precedence. OPAMCLI is only inspected if `--cli' is not given.
Since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1' for 2.1 later versions, since an environment variable controlling the parsing of syntax is brittle. To this end, opam displays a warning if OPAMCLI specifies a valid version other than 2.0, and also if `--cli=2.0' is specified.
As an exception to the following, the `exec' command returns 127 if the command was not found or couldn't be executed, and the command's exit value otherwise.
See https://opam.ocaml.org/doc.
Vincent Bernardoff <vb@luminar.eu.org>
Raja Boujbel <raja.boujbel@ocamlpro.com>
Roberto Di Cosmo <roberto@dicosmo.org>
Thomas Gazagnaire <thomas@gazagnaire.org>
Louis Gesbert <louis.gesbert@ocamlpro.com>
Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
Anil Madhavapeddy <anil@recoil.org>
Guillem Rieu <guillem.rieu@ocamlpro.com>
Ralf Treinen <ralf.treinen@pps.jussieu.fr>
Frederic Tuong <tuong@users.gforge.inria.fr>
Check bug reports at https://github.com/ocaml/opam/issues.