1opam-env(1)                       Opam Manual                      opam-env(1)
2
3
4

NAME

6       opam-env - Prints appropriate shell variable assignments to stdout
7

SYNOPSIS

9       opam env [OPTION]...
10

DESCRIPTION

12       Returns the bindings for the environment variables set in the current
13       switch, e.g. PATH, in a format intended to be evaluated by a shell.
14       With -v, add comments documenting the reason or package of origin for
15       each binding. This is most usefully used as eval $(opam env) to have
16       further shell commands be evaluated in the proper opam context.
17
18       This is a shortcut, and equivalent to opam config env.
19

OPTIONS

21       --inplace-path
22           When updating the PATH variable, replace any pre-existing opam path
23           in-place rather than putting the new path in front. This means
24           programs installed in opam that were shadowed will remain so after
25           opam env
26
27       --revert
28           Output the environment with updates done by opam reverted instead.
29
30       --set-root
31           With the env and exec subcommands, also sets the OPAMROOT variable,
32           making sure further calls to opam will use the same root.
33
34       --set-switch
35           With the env and exec subcommands, also sets the OPAMSWITCH
36           variable, making sure further calls to opam will use the same
37           switch as this one.
38
39       --sexp
40           Print environment as an s-expression rather than in shell format
41
42       --shell=SHELL
43           Sets the configuration mode for opam environment appropriate for
44           SHELL. One of one of `bash', `sh', `csh', `zsh' or `fish'. Guessed
45           from the parent processes and the $SHELL variable by default.
46

COMMON OPTIONS

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

ENVIRONMENT VARIABLES

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

EXIT STATUS

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

FURTHER DOCUMENTATION

315       See https://opam.ocaml.org/doc.
316

AUTHORS

318       Vincent Bernardoff <vb@luminar.eu.org>
319       Raja Boujbel <raja.boujbel@ocamlpro.com>
320       Roberto Di Cosmo <roberto@dicosmo.org>
321       Thomas Gazagnaire <thomas@gazagnaire.org>
322       Louis Gesbert <louis.gesbert@ocamlpro.com>
323       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
324       Anil Madhavapeddy <anil@recoil.org>
325       Guillem Rieu <guillem.rieu@ocamlpro.com>
326       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
327       Frederic Tuong <tuong@users.gforge.inria.fr>
328

BUGS

330       Check bug reports at https://github.com/ocaml/opam/issues.
331
332
333
334Opam 2.0.1                                                         opam-env(1)
Impressum