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