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

ENVIRONMENT VARIABLES

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

EXIT STATUS

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

FURTHER DOCUMENTATION

373       See https://opam.ocaml.org/doc.
374

AUTHORS

376       Vincent Bernardoff <vb@luminar.eu.org>
377       Raja Boujbel <raja.boujbel@ocamlpro.com>
378       Roberto Di Cosmo <roberto@dicosmo.org>
379       Thomas Gazagnaire <thomas@gazagnaire.org>
380       Louis Gesbert <louis.gesbert@ocamlpro.com>
381       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
382       Anil Madhavapeddy <anil@recoil.org>
383       Guillem Rieu <guillem.rieu@ocamlpro.com>
384       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
385       Frederic Tuong <tuong@users.gforge.inria.fr>
386

BUGS

388       Check bug reports at https://github.com/ocaml/opam/issues.
389
390
391
392Opam 2.0.6                                                         OPAM-ENV(1)
Impressum