1OPAM-SWITCH(1) Opam Manual OPAM-SWITCH(1)
2
3
4
6 opam-switch - Manage multiple installation prefixes.
7
9 opam switch [OPTION]... [COMMAND] [ARG]...
10
12 This command is used to manage "switches", which are independent
13 installation prefixes with their own compiler and sets of installed and
14 pinned packages. This is typically useful to have different versions of
15 the compiler available at once.
16
17 Use opam switch create to create a new switch, and opam switch set to
18 set the currently active switch. Without argument, lists installed
19 switches, with one switch argument, defaults to set.
20
21 Switch handles SWITCH can be either a plain name, for switches that
22 will be held inside ~/.opam, or a directory name, which in that case is
23 the directory where the switch prefix will be installed, as _opam. Opam
24 will automatically select a switch by that name found in the current
25 directory or its parents, unless OPAMSWITCH is set or --switch is
26 specified. When creating a directory switch, if package definitions are
27 found locally, the user is automatically prompted to install them after
28 the switch is created unless --no-install is specified.
29
30 opam switch set sets the default switch globally, but it is also
31 possible to select a switch in a given shell session, using the
32 environment. For that, use eval $(opam env --switch=SWITCH
33 --set-switch).
34
36 Without argument, defaults to list.
37
38 SWITCH
39 With a SWITCH argument, defaults to set SWITCH.
40
41 create SWITCH [COMPILER]
42 Create a new switch, and install the given compiler there. SWITCH
43 can be a plain name, or a directory, absolute or relative, in which
44 case a local switch is created below the given directory. COMPILER,
45 if omitted, defaults to SWITCH if it is a plain name, unless
46 --packages, --formula or --empty is specified. When creating a
47 local switch, and none of these options are present, the compiler
48 is chosen according to the configuration default (see
49 opam-init(1)). If the chosen directory contains package
50 definitions, a compatible compiler is searched within the default
51 selection, and the packages will automatically get installed.
52
53 set SWITCH
54 Set the currently active switch, among the installed switches.
55
56 remove SWITCH
57 Remove the given switch from disk.
58
59 export FILE
60 Save the current switch state to a file. If --full is specified, it
61 includes the metadata of all installed packages, and if --freeze is
62 specified, it freezes all vcs to their current commit.
63
64 import FILE
65 Import a saved switch state. If --switch is specified and doesn't
66 point to an existing switch, the switch will be created for the
67 import.
68
69 reinstall [SWITCH]
70 Reinstall the given compiler switch and all its packages.
71
72 list
73 Lists installed switches.
74
75 list-available [PATTERN]
76 Lists all the possible packages that are advised for installation
77 when creating a new switch, i.e. packages with the compiler flag
78 set. If no pattern is supplied, all versions are shown.
79
80 show
81 Prints the name of the current switch.
82
83 invariant
84 Prints the active switch invariant.
85
86 set-invariant PACKAGES
87 Updates the switch invariant, that is, the formula that the switch
88 must keep verifying throughout all operations. The previous setting
89 is overriden. See also options --force and --no-action. Without
90 arguments, an invariant is chosen automatically.
91
92 set-description STRING
93 Sets the description for the selected switch.
94
95 link SWITCH [DIR]
96 Sets a local alias for a given switch, so that the switch gets
97 automatically selected whenever in that directory or a descendant.
98
99 install SWITCH
100 Removed in 2.1, use create instead.
101
102 set-base PACKAGES
103 Removed in 2.1, use set-invariant instead.
104
106 opam switch create 4.08.0
107
108 Create a new switch called "4.08.0" and select it, with a compiler
109 automatically selected at version 4.08.0 (note that this can fail in
110 case there is more than one compiler matching that version).
111
112 opam switch create ./ --deps-only
113
114 Prepare a local switch for building the packages defined in ./. This
115 scans the current directory for package definitions, chooses a
116 compatible compiler, creates a local switch and installs the local
117 package dependencies.
118
119 opam switch create trunk --repos default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git ocaml-variants.4.10.0+trunk
120
121 Create a new switch called "trunk", with ocaml-variants.4.10.0+trunk as
122 compiler, with a new beta repository bound to the given URL selected
123 besides the default one.
124
126 -A COMP, --alias-of=COMP
127 Removed in 2.1.
128
129 --deps-only
130 When creating a local switch in a project directory (i.e. a
131 directory containing opam package definitions), install the
132 dependencies of the project but not the project itself.
133
134 --description=STRING
135 Attach the given description to a switch when creating it. Use the
136 set-description subcommand to modify the description of an existing
137 switch.
138
139 --empty
140 Allow creating an empty switch, with no invariant.
141
142 --force
143 Only for set-invariant: force setting the invariant, bypassing
144 consistency checks.
145
146 --formula=FORMULA
147 Allows specifying a complete "dependency formula", possibly
148 including disjunction cases, as the switch invariant.
149
150 --freeze
151 When exporting, locks all VCS urls to their current commit, failing
152 if it can not be retrieved. This ensures that an import will
153 restore the exact state. Implies --full.
154
155 --full
156 When exporting, include the metadata of all installed packages,
157 allowing to re-import even if they don't exist in the repositories
158 (the default is to include only the metadata of pinned packages).
159
160 -j JOBS, --jobs=JOBS
161 Set the maximal number of concurrent jobs to use. The default value
162 is calculated from the number of cores. You can also set it using
163 the $OPAMJOBS environment variable.
164
165 -n, --no-action
166 Only for set-invariant: set the invariant, but don't enforce it
167 right away: wait for the next install, upgrade or similar command.
168
169 --no
170 Answer no to all opam yes/no questions without prompting. See also
171 --confirm-level. This is equivalent to setting $OPAMNO to "true".
172
173 --no-autoinstall
174 Removed in 2.1.
175
176 --no-install
177 When creating a local switch, don't look for any local package
178 definitions to install.
179
180 --no-switch
181 Don't automatically select newly installed switches.
182
183 --packages=PACKAGES
184 When installing a switch, explicitly define the set of packages to
185 enforce as the switch invariant.
186
187 --repositories=REPOS
188 When creating a new switch, use the given selection of repositories
189 instead of the default. REPOS should be a comma-separated list of
190 either already registered repository names (configured through e.g.
191 opam repository add --dont-select), or NAME=URL bindings, in which
192 case NAME should not be registered already to a different URL, and
193 the new repository will be registered. See opam repository for more
194 details. This option also affects list-available.
195
196 -s, --short
197 Output raw lists of names, one per line, skipping any details.
198
199 -y, --yes
200 Answer yes to all opam yes/no questions without prompting. See also
201 --confirm-level. This is equivalent to setting $OPAMYES to "true".
202
204 --assume-depexts
205 Skip the installation step for any missing system packages, and
206 attempt to proceed with compilation of the opam packages anyway. If
207 the installation is successful, opam won't prompt again about these
208 system packages. Only meaningful if external dependency handling is
209 enabled.
210
211 -b, --keep-build-dir
212 Keep the build directories after compiling packages. This is
213 equivalent to setting $OPAMKEEPBUILDDIR to "true".
214
215 --build-doc
216 Removed in 2.1, use --with-doc instead.
217
218 --build-test
219 Removed in 2.1, use --with-test instead.
220
221 -d, --with-doc
222 Build the package documentation. This only affects packages listed
223 on the command-line. This is equivalent to setting $OPAMWITHDOC (or
224 the deprecated $OPAMBUILDDOC) to "true".
225
226 --dry-run
227 Simulate the command, but don't actually perform any changes. This
228 also can be set with environment variable $OPAMDEBUG.
229
230 --fake
231 This option registers the actions into the opam database, without
232 actually performing them. WARNING: This option is dangerous and
233 likely to break your opam environment. You probably want --dry-run.
234 You've been warned.
235
236 --ignore-constraints-on[=PACKAGES] (default=)
237 Forces opam to ignore version constraints on all dependencies to
238 the listed packages. This can be used to test compatibility, but
239 expect builds to break when using this. Note that version
240 constraints on optional dependencies and conflicts are unaffected.
241 This is equivalent to setting $OPAMIGNORECONSTRAINTS.
242
243 --inplace-build
244 When compiling a package which has its source bound to a local
245 directory, process the build and install actions directly in that
246 directory, rather than in a clean copy handled by opam. This only
247 affects packages that are explicitly listed on the command-line.
248 This is equivalent to setting $OPAMINPLACEBUILD to "true".
249
250 --lock-suffix=SUFFIX (absent=locked)
251 Set locked files suffix to SUFFIX.
252
253 --locked
254 In commands that use opam files found from pinned sources, if a
255 variant of the file with an added .locked extension is found (e.g.
256 foo.opam.locked besides foo.opam), that will be used instead. This
257 is typically useful to offer a more specific set of dependencies
258 and reproduce similar build contexts, hence the name. The
259 lockoption can be used to generate such files, based on the
260 versions of the dependencies currently installed on the host. This
261 is equivalent to setting the $OPAMLOCKED environment variable. Note
262 that this option doesn't generally affect already pinned packages.
263
264 -m MAKE, --make=MAKE
265 Removed in 2.1, use opam config set[-global] make MAKE instead.
266
267 --no-checksums
268 Do not verify the checksum of downloaded archives.This is
269 equivalent to setting $OPAMNOCHECKSUMS to "true".
270
271 --no-depexts
272 Temporarily disables handling of external dependencies. This can be
273 used if a package is not available on your system package manager,
274 but you installed the required dependency by hand. Implies
275 --assume-depexts, and stores the exceptions upon success as well.
276
277 --require-checksums
278 Reject the installation of packages that don't provide a checksum
279 for the upstream archives. This is equivalent to setting
280 $OPAMREQUIRECHECKSUMS to "true".
281
282 --reuse-build-dir
283 Reuse existing build directories (kept by using --keep-build-dir),
284 instead of compiling from a fresh clone of the source. This can be
285 faster, but also lead to failures if the build systems of the
286 packages don't handle upgrades of dependencies well. This is
287 equivalent to setting $OPAMREUSEBUILDDIR to "true".
288
289 --show-actions
290 Call the solver and display the actions. Don't perform any changes.
291 This is equivalent to setting $OPAMSHOW.
292
293 --skip-updates
294 When running an install, upgrade or reinstall on source-pinned
295 packages, they are normally updated from their origin first. This
296 flag disables that behaviour and will keep them to their version in
297 cache. This is equivalent to setting $OPAMSKIPUPDATE.
298
299 -t, --with-test
300 Build and run the package unit-tests. This only affects packages
301 listed on the command-line. This is equivalent to setting
302 $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true".
303
304 --unlock-base
305 Removed in 2.1, use --update-invariant instead.
306
307 --update-invariant
308 Allow changes to the packages set as switch base (typically, the
309 main compiler). Use with caution. This is equivalent to setting the
310 $OPAMUNLOCKBASE environment variable
311
313 These options are common to all commands.
314
315 --best-effort
316 Don't fail if all requested packages can't be installed: try to
317 install as many as possible. Note that not all external solvers may
318 support this option (recent versions of aspcud or mccs should).
319 This is equivalent to setting $OPAMBESTEFFORT environment variable.
320
321 --cli=MAJOR.MINOR (absent=2.1)
322 Use the command-line interface syntax and semantics of MAJOR.MINOR.
323 Intended for any persistent use of opam (scripts, blog posts,
324 etc.), any version of opam in the same MAJOR series will behave as
325 for the specified MINOR release. The flag was not available in opam
326 2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
327 to 2.0 instead of using this parameter.
328
329 --color=WHEN
330 Colorize the output. WHEN must be one of `always', `never' or
331 `auto'.
332
333 --confirm-level=LEVEL
334 Confirmation level, LEVEL must be one of `ask', `no', `yes' or
335 `unsafe-yes'. Can be specified more than once. If --yes or --no are
336 also given, the value of the last --confirm-level is taken into
337 account. This is equivalent to setting $OPAMCONFIRMLEVEL`.
338
339 --criteria=CRITERIA
340 Specify user preferences for dependency solving for this run.
341 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
342 on the supported language, and the external solvers available, see
343 http://opam.ocaml.org/doc/External_solvers.html. A general guide to
344 using solver preferences can be found at
345 http://www.dicosmo.org/Articles/usercriteria.pdf.
346
347 --cudf=FILENAME
348 Debug option: Save the CUDF requests sent to the solver to
349 FILENAME-<n>.cudf.
350
351 --debug
352 Print debug message to stderr. This is equivalent to setting
353 $OPAMDEBUG to "true".
354
355 --debug-level=LEVEL
356 Like --debug, but allows specifying the debug level (--debug sets
357 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
358
359 --git-version
360 Print the git version of opam, if set (i.e. you are using a
361 development version), and exit.
362
363 --help[=FMT] (default=auto)
364 Show this help in format FMT. The value FMT must be one of `auto',
365 `pager', `groff' or `plain'. With `auto', the format is `pager` or
366 `plain' whenever the TERM env var is `dumb' or undefined.
367
368 --ignore-pin-depends
369 Ignore extra pins required by packages that get pinned, either
370 manually through opam pin or through opam install DIR. This is
371 equivalent to setting IGNOREPINDEPENDS=true.
372
373 --json=FILENAME
374 Save the results of the opam run in a computer-readable file. If
375 the filename contains the character `%', it will be replaced by an
376 index that doesn't overwrite an existing file. Similar to setting
377 the $OPAMJSON variable.
378
379 --no-aspcud
380 Removed in 2.1.
381
382 --no-auto-upgrade
383 When configuring or updating a repository that is written for an
384 earlier opam version (1.2), opam internally converts it to the
385 current format. This disables this behaviour. Note that
386 repositories should define their format version in a 'repo' file at
387 their root, or they will be assumed to be in the older format. It
388 is, in any case, preferable to upgrade the repositories manually
389 using opam admin upgrade [--mirror URL] when possible.
390
391 --no-self-upgrade
392 Opam will replace itself with a newer binary found at OPAMROOT/opam
393 if present. This disables this behaviour.
394
395 -q, --quiet
396 Disables --verbose.
397
398 --root=ROOT
399 Use ROOT as the current root path. This is equivalent to setting
400 $OPAMROOT to ROOT.
401
402 --safe, --readonly
403 Make sure nothing will be automatically updated or rewritten.
404 Useful for calling from completion scripts, for example. Will fail
405 whenever such an operation is needed ; also avoids waiting for
406 locks, skips interactive questions and overrides the $OPAMDEBUG
407 variable. This is equivalent to set environment variable $OPAMSAFE.
408
409 --solver=CMD
410 Specify the CUDF solver to use for resolving package installation
411 problems. This is either a predefined solver (this version of opam
412 supports builtin-mccs+lp(), builtin-mccs+glpk,
413 builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
414 mccs, aspcud-old, packup), or a custom command that should contain
415 the variables %{input}%, %{output}%, %{criteria}%, and optionally
416 %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
417
418 --strict
419 Fail whenever an error is found in a package definition or a
420 configuration file. The default is to continue silently if
421 possible.
422
423 --switch=SWITCH
424 Use SWITCH as the current compiler switch. This is equivalent to
425 setting $OPAMSWITCH to SWITCH.
426
427 --use-internal-solver
428 Disable any external solver, and use the built-in one (this
429 requires that opam has been compiled with a built-in solver). This
430 is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
431
432 -v, --verbose
433 Be more verbose. One -v shows all package commands, repeat to also
434 display commands called internally (e.g. tar, curl, patch etc.)
435 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
436
437 --version
438 Show version information.
439
440 -w, --working-dir
441 Whenever updating packages that are bound to a local,
442 version-controlled directory, update to the current working state
443 of their source instead of the last committed state, or the ref
444 they are pointing to. As source directory is copied as it is, if it
445 isn't clean it may result on a opam build failure.This only affects
446 packages explicitly listed on the command-line.It can also be set
447 with $OPAMWORKINGDIR.
448
450 Opam makes use of the environment variables listed here. Boolean
451 variables should be set to "0", "no", "false" or the empty string to
452 disable, "1", "yes" or "true" to enable.
453
454 OPAMALLPARENS surround all filters with parenthesis.
455
456 OPAMASSUMEDEPEXTS see option `--assume-depexts'.
457
458 OPAMAUTOREMOVE see remove option `--auto-remove'.
459
460 OPAMBESTEFFORT see option `--best-effort'.
461
462 OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
463 the criteria when the `--best-effort' option is set, and is expected to
464 maximise the `opam-query' property in the solution.
465
466 OPAMBUILDDOC Removed in 2.1.
467
468 OPAMBUILDTEST Removed in 2.1.
469
470 OPAMCLI see option `--cli'.
471
472 OPAMCOLOR when set to always or never, sets a default value for the
473 `--color' option.
474
475 OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
476 priority over OPAMYES and OPAMNO.
477
478 OPAMCRITERIA specifies user preferences for dependency solving. The
479 default value depends on the solver version, use `config report' to
480 know the current setting. See also option --criteria.
481
482 OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
483
484 OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
485 preprocessing.
486
487 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
488 for more options.
489
490 OPAMDEBUG see options `--debug' and `--debug-level'.
491
492 OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
493 list of sections. Sections can optionally have a specific debug level
494 (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
495 `--debug-level'.
496
497 OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
498 CUDF preprocessing is.
499
500 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
501
502 OPAMDROPWORKINGDIR overrides packages previously updated with
503 --working-dir on update. Without this variable set, opam would keep
504 them unchanged unless explicitly named on the command-line.
505
506 OPAMDRYRUN see option `--dry-run'.
507
508 OPAMEDITOR sets the editor to use for opam file editing, overrides
509 $EDITOR and $VISUAL.
510
511 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
512 fails. 0 to print all.
513
514 OPAMEXTERNALSOLVER see option `--solver'.
515
516 OPAMFAKE see option `--fake'.
517
518 OPAMFETCH specifies how to download files: either `wget', `curl' or a
519 custom command where variables %{url}%, %{out}%, %{retry}%,
520 %{compress}% and %{checksum}% will be replaced. Overrides the
521 'download-command' value from the main config file.
522
523 OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
524
525 OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
526
527 OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
528
529 OPAMINPLACEBUILD see option `--inplace-build'.
530
531 OPAMJOBS sets the maximum number of parallel workers to run.
532
533 OPAMJSON log json output to the given file (use character `%' to index
534 the files).
535
536 OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
537
538 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
539 some backups. This skips some finalisers and may also help to get more
540 reliable backtraces.
541
542 OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
543
544 OPAMLOGS logdir sets log directory, default is a temporary directory in
545 /tmp
546
547 OPAMMAKECMD set the system make command to use.
548
549 OPAMMERGEOUT merge process outputs, stderr on stdout.
550
551 OPAMNO answer no to any question asked, see options `--no` and
552 `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
553 OPAMYES is set.
554
555 OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
556
557 OPAMNOASPCUD Deprecated.
558
559 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
560 in an earlier format to the current one, on 'update' or 'init'.
561
562 OPAMNOCHECKSUMS enables option --no-checksums when available.
563
564 OPAMNODEPEXTS disables system dependencies handling, see option
565 `--no-depexts'.
566
567 OPAMNOENVNOTICE Internal.
568
569 OPAMNOSELFUPGRADE see option `--no-self-upgrade'
570
571 OPAMPINKINDAUTO sets whether version control systems should be detected
572 when pinning to a local path. Enabled by default since 1.3.0.
573
574 OPAMPRECISETRACKING fine grain tracking of directories.
575
576 OPAMPREPRO set this to false to disable CUDF preprocessing. Less
577 efficient, but might help debugging solver issue.
578
579 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
580 available (e.g. for `opam install').
581
582 OPAMRETRIES sets the number of tries before failing downloads.
583
584 OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
585
586 OPAMROOT see option `--root'. This is automatically set by `opam env
587 --root=DIR --set-root'.
588
589 OPAMROOTISOK don't complain when running as root.
590
591 OPAMSAFE see option `--safe'.
592
593 OPAMSHOW see option `--show'.
594
595 OPAMSKIPUPDATE see option `--skip-updates'.
596
597 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
598 compatibility testing only.
599
600 OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
601 return a solution when they reach timeout; while the solution remains
602 assured to be consistent, there is no guarantee in this case that it
603 fits the expected optimisation criteria. If `true', opam willcontinue
604 with a warning, if `false' a timeout is an error. Currently only the
605 builtin-z3 backend handles this degraded case.
606
607 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
608 60.0, set to 0 for unlimited. Note that all solvers may not support
609 this option.
610
611 OPAMSTATS display stats at the end of command.
612
613 OPAMSTATUSLINE display a dynamic status line showing what's currently
614 going on on the terminal. (one of one of `always', `never' or `auto')
615
616 OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
617
618 OPAMSWITCH see option `--switch'. Automatically set by `opam env
619 --switch=SWITCH --set-switch'.
620
621 OPAMUNLOCKBASE see install option `--unlock-base'.
622
623 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
624 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
625 are set. See also option --criteria.
626
627 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
628
629 OPAMUSEOPENSSL force openssl use for hash computing.
630
631 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
632 or `auto'). By default `auto', which is determined from the locale).
633
634 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
635 Implies OPAMUTF8. This is set by default on OSX only.
636
637 OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
638 opam repository update.
639
640 OPAMVERBOSE see option `--verbose'.
641
642 OPAMVERSIONLAGPOWER do not use.
643
644 OPAMWITHDOC see install option `--with-doc'.
645
646 OPAMWITHTEST see install option `--with-test.
647
648 OPAMWORKINGDIR see option `--working-dir'.
649
650 OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
651 priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
652
653 OPAMVAR_var overrides the contents of the variable var when
654 substituting `%{var}%` strings in `opam` files.
655
656 OPAMVAR_package_var overrides the contents of the variable package:var
657 when substituting `%{package:var}%` strings in `opam` files.
658
660 All scripts and programmatic invocations of opam should use `--cli' in
661 order to ensure that they work seamlessly with future versions of the
662 opam client. Additionally, blog posts or other documentation can
663 benefit, as it prevents information from becoming stale.
664
665 Although opam only supports roots (~/.opam/) for the current version,
666 it does provide backwards compatibility for its command-line interface.
667
668 Since CLI version support was only added in opam 2.1, use OPAMCLI to
669 select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
670 for 2.1 (or later) versions, since an environment variable controlling
671 the parsing of syntax is brittle. To this end, opam displays a warning
672 if OPAMCLI specifies a valid version other than 2.0, and also if
673 `--cli=2.0' is specified.
674
675 The command-line version is selected by using the `--cli' option or the
676 OPAMCLI environment variable. `--cli' may be specified morethan once,
677 where the last instance takes precedence. OPAMCLI is only inspected if
678 `--cli' is not given.
679
681 As an exception to the following, the `exec' command returns 127 if the
682 command was not found or couldn't be executed, and the command's exit
683 value otherwise.
684
685 0 Success, or true for boolean queries.
686
687 1 False. Returned when a boolean return value is expected, e.g. when
688 running with --check, or for queries like opam lint.
689
690 2 Bad command-line arguments, or command-line arguments pointing to
691 an invalid context (e.g. file not following the expected format).
692
693 5 Not found. You requested something (package, version, repository,
694 etc.) that couldn't be found.
695
696 10 Aborted. The operation required confirmation, which wasn't given.
697
698 15 Could not acquire the locks required for the operation.
699
700 20 There is no solution to the user request. This can be caused by
701 asking to install two incompatible packages, for example.
702
703 30 Error in package definition, or other metadata files. Using
704 --strict raises this error more often.
705
706 31 Package script error. Some package operations were unsuccessful.
707 This may be an error in the packages or an incompatibility with
708 your system. This can be a partial error.
709
710 40 Sync error. Could not fetch some remotes from the network. This can
711 be a partial error.
712
713 50 Configuration error. Opam or system configuration doesn't allow
714 operation, and needs fixing.
715
716 60 Solver failure. The solver failed to return a sound answer. It can
717 be due to a broken external solver, or an error in solver
718 configuration.
719
720 99 Internal error. Something went wrong, likely due to a bug in opam
721 itself.
722
723 130 User interrupt. SIGINT was received, generally due to the user
724 pressing Ctrl-C.
725
727 See https://opam.ocaml.org/doc.
728
730 Vincent Bernardoff <vb@luminar.eu.org>
731 Raja Boujbel <raja.boujbel@ocamlpro.com>
732 Roberto Di Cosmo <roberto@dicosmo.org>
733 Thomas Gazagnaire <thomas@gazagnaire.org>
734 Louis Gesbert <louis.gesbert@ocamlpro.com>
735 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
736 Anil Madhavapeddy <anil@recoil.org>
737 Guillem Rieu <guillem.rieu@ocamlpro.com>
738 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
739 Frederic Tuong <tuong@users.gforge.inria.fr>
740
742 Check bug reports at https://github.com/ocaml/opam/issues.
743
744
745
746Opam 2.1.1 OPAM-SWITCH(1)