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