OPAM-UPDATE(1)

✨ OPAM-UPDATE ✨

okay so bestie, this is opam-update, living in the Opam Manual πŸ’… It does one iconic thing: it freshens up your list of available packages.


🌸 NAME 🌸

opam-update β€” update the list of available packages, periodt. No cap.


πŸŽ€ SYNOPSIS πŸŽ€

opam update [OPTION]… [NAMES]…

that's it. that's the whole vibe. options go brrr, then optionally some names 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So like, this is the one that updates your package definitions ✨ It fetches the newest version of the repositories you set up with opam repository, plus the sources of your installed development packages and the packages pinned in the current switch.

and then… to actually use those fresh new sources and definitions? you gotta run opam upgrade, bestie. opam update is literally just the "go get the new stuff" step. it's giving preparation. it's giving main character setup energy πŸ‘‘


πŸ’– ARGUMENTS πŸ’–

  • NAMES β€” the list of repository names or development package names you wanna update. that's it, that's the whole argument 🌈

✨ OPTIONS ✨

  • -a, --all β€” update every single configured repository, not just whatever's set in the current switch. go big or go home honestly πŸ’…
  • --check β€” does the update, then bounces with exit code 0 if there were any upstream changes, and 1 if there were none πŸ‘€ Repositories or development packages that failed to update are considered as having no changes (yeah, that's the rule, iykyk). And when you pair it with --upgrade, it applies to the upgrade step instead: so opam update --upgrade --check behaves like opam update && opam upgrade --check, returning 0 if there are available upgrades, rather than upstream updates. two different flavours of the same check, slay.
  • --depexts β€” asks your system package manager to update its databases and refresh the cached system package availability. ngl this generally needs sudo rights πŸ™ˆ Also: this skips all opam packages, unless you also pass --development or --repositories. team effort only.
  • --development β€” update development packages. and yes, it skips repositories unless --repositories is also specified. they're a package deal, literally.
  • -j JOBS, --jobs=JOBS β€” sets the max number of concurrent jobs. default value gets calculated from the number of cores on your machine 🧠✨ You can also set it with the $OPAMJOBS environment variable.
  • -R, --repositories β€” update repositories, skipping development packages unless --development is also specified. same deal as above, just the other way around πŸ’–
  • -u, --upgrade β€” automatically runs opam upgrade after the update. one command, double the chaos, no thoughts head empty πŸ”₯

🫢 COMMON OPTIONS 🫢

these ones are the shared options β€” literally every command has them, they're the group-chat regulars.

  • --best-effort β€” don't fail just because not all requested packages can be installed: try to install as many as possible πŸ₯Ί Heads up though: not all external solvers may support this option (recent versions of aspcud or mccs should). It's equivalent to setting the $OPAMBESTEFFORT environment variable.
  • --cli=MAJOR.MINOR (absent=2.6) β€” use the command-line interface syntax and semantics of MAJOR.MINOR. This is intended for any persistent use of opam (scripts, blog posts, etc.) β€” any version of opam in the same MAJOR series will behave as for the specified MINOR release. Important lore: this flag was not available in opam 2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable to 2.0 instead of using this parameter πŸ™ˆ
  • --color=WHEN β€” colorizes the output πŸ’… WHEN must be one of always, never or auto.
  • --confirm-level=LEVEL β€” sets the confirmation level. LEVEL must be one of ask, no, yes or unsafe-yes πŸ‘‘ Can be specified more than once. If --yes or --no are also given, the value of the last --confirm-level is what counts. This is equivalent to setting $OPAMCONFIRMLEVEL.
  • --criteria=CRITERIA β€” specify your user preferences for dependency solving, just for this run. It overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. For the details on the supported language, and the external solvers available, see http://opam.ocaml.org/doc/External_solvers.html. A general guide to using solver preferences lives at http://www.dicosmo.org/Articles/usercriteria.pdf πŸ“š
  • --cudf=FILENAME β€” debug option, bestie: saves the CUDF requests sent to the solver to FILENAME-<n>.cudf, where <n> is the n-th call to the solver during the opam run. nerdy and useful ✨
  • --debug β€” prints debug messages to stderr. Equivalent to setting $OPAMDEBUG to "true".
  • --debug-level=LEVEL β€” like --debug, but you get to pick the debug level (--debug sets it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
  • --git-version β€” prints the git version of opam, if it's set (i.e. you're running a development version), and exits. bye πŸ‘‹
  • --help[=FMT] (default=auto) β€” shows this help in format FMT. The value FMT must be one of auto, pager, groff or plain. With auto, the format is pager or plain whenever the TERM env var is dumb or undefined. the classic πŸŽ€
  • --ignore-pin-depends β€” ignores extra pins required by packages that get pinned, whether manually through opam pin or through opam install DIR. Equivalent to setting IGNOREPINDEPENDS=true.
  • --json=FILENAME β€” saves the results of the opam run into a computer-readable file πŸ€– If the filename contains the character %, it will be replaced by an index that doesn't overwrite an existing file. Similar to setting the $OPAMJSON variable.
  • --no β€” answers no to all opam yes/no questions without prompting. See also --confirm-level. Equivalent to setting $OPAMNO to "true".
  • --no-aspcud β€” removed in 2.1 πŸ’€ rip bozo.
  • --no-auto-upgrade β€” when configuring or updating a repository written for an earlier opam version (1.2), opam internally converts it to the current format. This disables that behaviour. Note that repositories should define their format version in a 'repo' file at their root, or they'll be assumed to be in the older format. It is, in any case, preferable to upgrade the repositories manually using opam admin upgrade [--mirror URL] when possible 🫢
  • --no-self-upgrade β€” opam will replace itself with a newer binary found at OPAMROOT/opam if present. This disables that behaviour. no glowy-up for opam today βœ‹
  • -q, --quiet β€” disables --verbose. shhh 🀫
  • --root=ROOT β€” use ROOT as the current root path. Equivalent to setting $OPAMROOT to ROOT.
  • --safe, --readonly β€” makes sure nothing will be automatically updated or rewritten. Super useful for calling from completion scripts, for example. It will fail whenever such an operation is needed; it also avoids waiting for locks, skips interactive questions, and overrides the $OPAMDEBUG variable. Equivalent to setting the environment variable $OPAMSAFE. cautious queen πŸ‘‘
  • --solver=CMD β€” specify the CUDF solver to use for resolving package installation problems. This is either a predefined solver β€” this version of opam supports builtin-mccs+lp(), builtin-mccs+glpk, builtin-dummy-z3-solver, builtin-0install, aspcud, mccs, aspcud-old, packup β€” or a custom command that should contain the variables %{input}%, %{output}%, %{criteria}%, and optionally %{timeout}%. Equivalent to setting $OPAMEXTERNALSOLVER 🧚
  • --strict β€” fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. no more sweeping things under the rug πŸ’€
  • --switch=SWITCH β€” use SWITCH as the current compiler switch. Equivalent to setting $OPAMSWITCH to SWITCH.
  • --use-internal-solver β€” disables any external solver and uses the built-in one instead (this requires that opam has been compiled with a built-in solver). Equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
  • -v, --verbose β€” be more verbose. One -v shows all package commands, repeat it to also display commands called internally (e.g. tar, curl, patch etc.) Repeating n times is equivalent to setting $OPAMVERBOSE to "n" πŸ—£οΈ
  • --version β€” shows version information.
  • -w, --working-dir β€” whenever updating packages that are bound to a local, version-controlled directory, update to the current working state of their source instead of the last committed state, or the ref they are pointing to. Careful though: as the source directory is copied as it is, if it isn't clean it may result in an opam build failure 😭 This only affects packages explicitly listed on the command-line. It can also be set with $OPAMWORKINGDIR.
  • -y, --yes β€” answers yes to all opam yes/no questions without prompting. See also --confirm-level. Equivalent to setting $OPAMYES to "true" πŸ’–

πŸ¦‹ ENVIRONMENT πŸ¦‹

okay bestie, opam reads a whole roster of environment variables, and we're going through every single one. no skipping πŸ’… here's the vibe first though:

if it's a boolean variable, set it to "0", "no", "false" or the empty string to turn it off, and set it to "1", "yes" or "true" to turn it on. that's the whole system, it's giving simple. periodt.

  • OPAMALLPARENS β€” surround all filters with parenthesis. yes, all of them, she loves a bracket πŸŽ€
  • OPAMASSUMEDEPEXTS β€” see option --assume-depexts.
  • OPAMAUTOANSWER β€” internal use only. hands off bestie, this one's not for you πŸ’€
  • OPAMAUTOREMOVE β€” see remove option --auto-remove.
  • OPAMBESTEFFORT β€” see option --best-effort.
  • OPAMBESTEFFORTPREFIXCRITERIA β€” sets the string that must be prepended to the criteria when the --best-effort option is set, and it's expected to maximise the opam-query property in the solution.
  • OPAMBUILDDOC β€” Removed in 2.1. πŸ’€
  • OPAMBUILDTEST β€” Removed in 2.1. πŸ’€
  • OPAMCLI β€” see option --cli.
  • OPAMCOLOR β€” when set to always or never, sets a default value for the --color option.
  • OPAMCONFIRMLEVEL β€” see option --confirm-level. OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO. πŸ‘‘
  • OPAMCRITERIA β€” specifies user preferences for dependency solving. The default value depends on the solver version, so use config report to know the current setting. See also option --criteria.
  • OPAMCUDFFILE β€” save the cudf graph to file-actions-explicit.dot.
  • OPAMCUDFTRIM β€” controls the filtering of unrelated packages during CUDF preprocessing.
  • OPAMCURL β€” can be used to select a given curl program. See OPAMFETCH for more options.
  • OPAMDEBUG β€” see options --debug and --debug-level.
  • OPAMDEBUGSECTIONS β€” if set, limits debug messages to the space-separated list of sections. Sections can optionally have a specific debug level (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use --debug-level.
  • OPAMDIGDEPTH β€” defines how aggressive the lookup for conflicts during CUDF preprocessing is. she digs, literally ✨
  • OPAMDOWNLOADJOBS β€” sets the maximum number of simultaneous downloads.
  • OPAMDROPWORKINGDIR β€” overrides packages previously updated with --working-dir on update. Without this variable set, opam would keep them unchanged unless explicitly named on the command-line.
  • OPAMDRYRUN β€” see option --dry-run.
  • OPAMEDITOR β€” sets the editor to use for opam file editing, overrides $EDITOR and $VISUAL. she said my editor, not yours 🫢
  • OPAMERRLOGLEN β€” sets the number of log lines printed when a sub-process fails. 0 to print all.
  • OPAMEXTERNALSOLVER β€” see option --solver.
  • OPAMFAKE β€” see option --fake.
  • OPAMFETCH β€” specifies how to download files: either wget, curl or a custom command where variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% will be replaced. Overrides the download-command value from the main config file.
  • OPAMFIXUPCRITERIA β€” same as OPAMUPGRADECRITERIA, but specific to fixup and reinstall.
  • OPAMIGNOREAVAILABLE β€” see install option --ignore-available-on.
  • OPAMIGNORECONSTRAINTS β€” see install option --ignore-constraints-on.
  • OPAMIGNOREPINDEPENDS β€” see option --ignore-pin-depends.
  • OPAMINPLACEBUILD β€” see option --inplace-build.
  • OPAMJOBS β€” sets the maximum number of parallel workers to run. multitasking queen πŸ’…
  • OPAMJSON β€” log json output to the given file (use character % to index the files).
  • OPAMKEEPBUILDDIR β€” see install option --keep-build-dir.
  • OPAMKEEPLOGS β€” tells opam to not remove some temporary command logs and some backups. This skips some finalisers and may also help to get more reliable backtraces.
  • OPAMLOCKED β€” combination of --locked and --lock-suffix options.
  • OPAMLOGS β€” logdir sets log directory, default is a temporary directory in /tmp
  • OPAMMAKECMD β€” set the system make command to use.
  • OPAMMERGEOUT β€” merge process outputs, stderr on stdout.
  • OPAMNO β€” answer no to any question asked, see options --no and --confirm-level. OPAMNO is ignored if either OPAMCONFIRMLEVEL or OPAMYES is set.
  • OPAMNOAGGREGATE β€” with opam admin check, don't aggregate packages.
  • OPAMNOASPCUD β€” Deprecated.
  • OPAMNOAUTOUPGRADE β€” disables automatic internal upgrade of repositories in an earlier format to the current one, on update or init.
  • OPAMNOCHECKSUMS β€” enables option --no-checksums when available.
  • OPAMNODEPEXTS β€” disables system dependencies handling, see option --no-depexts.
  • OPAMNOENVNOTICE β€” Internal.
  • OPAMNOSELFUPGRADE β€” see option --no-self-upgrade
  • OPAMPINKINDAUTO β€” sets whether version control systems should be detected when pinning to a local path. Enabled by default since 1.3.0.
  • OPAMPRECISETRACKING β€” fine grain tracking of directories.
  • OPAMPREPRO β€” set this to false to disable CUDF preprocessing. Less efficient, but might help debugging solver issue.
  • OPAMREPOSITORYTARRING β€” internally store all non-vcs repositories as tar.gz files (by default, http repositories are stored as archive). This can be much faster on filesystems that don't cope well with scanning large trees. All operation are done in-memory, no I/O for scanning the repository.
  • OPAMREQUIRECHECKSUMS β€” Enables option --require-checksums when available (e.g. for opam install).
  • OPAMRETRIES β€” sets the number of tries before failing downloads.
  • OPAMREUSEBUILDDIR β€” see option --reuse-build-dir.
  • OPAMROOT β€” see option --root. This is automatically set by opam env --root=DIR --set-root.
  • OPAMROOTISOK β€” don't complain when running as root. rawr 🫢
  • OPAMSAFE β€” see option --safe.
  • OPAMSHOW β€” see option --show.
  • OPAMSKIPUPDATE β€” see option --skip-updates.
  • OPAMSKIPVERSIONCHECKS β€” bypasses some version checks. Unsafe, for compatibility testing only.
  • OPAMSOLVERALLOWSUBOPTIMAL β€” (default true) allows some solvers to still return a solution when they reach timeout; while the solution remains assured to be consistent, there is no guarantee in this case that it fits the expected optimisation criteria. If true, opam will continue with a warning, if false a timeout is an error. Currently only the builtin-z3 backend handles this degraded case.
  • OPAMSOLVERTIMEOUT β€” change the time allowance of the solver. Default is 60.0, set to 0 for unlimited. Note that all solvers may not support this option.
  • OPAMSOLVERTOLERANCE β€” changes the tolerance towards the solver choosing an unoptimized solution (i.e. might pull outdated packages). Typical values range from 0.0 (best solution known to the solver) to 1.0 (unoptimized solution). Default is 0.0. This option is useful in case the solver can't find a solution in a reasonable time (see $OPAMSOLVERTIMEOUT). Note that all solvers may not support this option.
  • OPAMSTATS β€” Removed in 2.4. πŸ’€
  • OPAMSTATUSLINE β€” display a dynamic status line showing what's currently going on on the terminal. (one of always, never or auto)
  • OPAMSTRICT β€” fail on inconsistencies (file reading, switch import, etc.).
  • OPAMSWITCH β€” see option --switch. Automatically set by opam env --switch=SWITCH --set-switch.
  • OPAMUNLOCKBASE β€” see install option --unlock-base.
  • OPAMUPGRADECRITERIA β€” specifies user preferences for dependency solving when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both are set. See also option --criteria.
  • OPAMUSEINTERNALSOLVER β€” see option --use-internal-solver.
  • OPAMUSEOPENSSL β€” Removed in 2.2. πŸ’€
  • OPAMUTF8 β€” use UTF8 characters in output (one of always, never or auto). By default auto, which is determined from the locale).
  • OPAMUTF8MSGS β€” use extended UTF8 characters (camels) in opam messages. Implies OPAMUTF8. This is set by default on macOS only. πŸͺ iconic.
  • OPAMVALIDATIONHOOK β€” if set, uses the %{hook}% command to validate an opam repository update.
  • OPAMVERBOSE β€” see option --verbose.
  • OPAMVERBOSEON β€” see option --verbose-on
  • OPAMVERSIONLAGPOWER β€” do not use. that's it. that's the whole description. bestie, heed the warning πŸ™ˆ
  • OPAMWITHDEVSETUP β€” see install option --with-dev-setup.
  • OPAMWITHDOC β€” see install option --with-doc.
  • OPAMWITHTEST β€” see install option --with-test.
  • OPAMWORKINGDIR β€” see option --working-dir.
  • OPAMYES β€” see options --yes and --confirm-level. OPAMYES has priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
  • OPAMVAR_var β€” overrides the contents of the variable var when substituting %{var}% strings in opam files.
  • OPAMVAR_package_var β€” overrides the contents of the variable package:var when substituting %{package:var}% strings in opam files.

🌈 CLI VERSION 🌈

okay this part is highkey important for anyone writing scripts, so listen up πŸ‘‘

All scripts and programmatic invocations of opam should use --cli in order to ensure that they work seamlessly with future versions of the opam client. plus, blog posts or other documentation can benefit too, because it prevents information from becoming stale. no more ancient tutorials from 2019, we love to see it ✨

Although opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface.

Since CLI version support was only added in opam 2.1, use OPAMCLI to select 2.0 support (as opam 2.0 will just ignore it), and --cli=2.1 for 2.1 (or later) versions, since an environment variable controlling the parsing of syntax is brittle. To this end, opam displays a warning if OPAMCLI specifies a valid version other than 2.0, and also if --cli=2.0 is specified.

The command-line version is selected by using the --cli option or the OPAMCLI environment variable. --cli may be specified more than once, where the last instance takes precedence. OPAMCLI is only inspected if --cli is not given.

pro tip vibe: last one wins, like always πŸ’… if you're passing --cli twice, the final one is the one she's listening to.

πŸ’₯ EXIT STATUS πŸ’₯

okay bestie, listen up, because exit codes are the whole personality of a Unix tool and opam has a lot of them πŸŽ€

⚠️ exception era: the exec command does NOT play by the rules below. It returns 127 if the command wasn't found or couldn't be executed, and otherwise it returns the command's own exit value. that's it, that's the whole exception, no notes πŸ’…

now the regular lineup, iconic and consistent ✨

  • 0 β€” success πŸŽ‰ or true for boolean queries.
  • 1 β€” False. shows up when a boolean return value is expected, like when you're running with --check, or for queries like opam lint.
  • 2 β€” bad command-line arguments, or command-line arguments pointing to an invalid context (e.g. a file that doesn't follow the expected format).
  • 5 β€” not found 😭. you asked for something (package, version, repository, etc.) that couldn't be found.
  • 10 β€” aborted πŸ›‘. the operation needed confirmation and nobody gave it.
  • 15 β€” could not acquire the locks required for the operation πŸ”’.
  • 20 β€” there's no solution to the user request πŸ’€. this can happen if you ask to install two incompatible packages, for example. not your fault, but also, bestie.
  • 30 β€” error in package definition, or other metadata files πŸ“„. heads up: using --strict raises this error more often.
  • 31 β€” package script error. some package operations were unsuccessful. this may be an error in the packages or an incompatibility with your system. and it can be a partial error, so don't panic the whole way 🫢
  • 40 β€” sync error. couldn't fetch some remotes from the network 🌐. this can also be a partial error.
  • 50 β€” configuration error. opam or system configuration doesn't allow the operation, and it needs fixing πŸ”§.
  • 60 β€” solver failure. the solver failed to return a sound answer. this can be due to a broken external solver, or an error in solver configuration 🧠πŸ’₯.
  • 99 β€” internal error. something went wrong, and it's likely a bug in opam itself πŸ›.
  • 130 β€” user interrupt. SIGINT was received, generally because the user smashed Ctrl+C πŸ˜….

and then there's this second lil set, which is the classic command-line-tool mood ✨

  • 0 β€” on success.
  • 123 β€” on indiscriminate errors reported on standard error.
  • 124 β€” on command line parsing errors.
  • 125 β€” on unexpected internal errors (bugs).

πŸ“š FURTHER DOCUMENTATION πŸ“š

more lore lives at https://opam.ocaml.org/doc β€” go read, it's giving required reading, no cap 🌈


πŸ‘‘ AUTHORS πŸ‘‘

the literal main characters who built this, show some respect bestie 🫢

  • David Allsopp <david@tarides.com>
  • Vincent Bernardoff <vb@luminar.eu.org>
  • Raja Boujbel <raja.boujbel@ocamlpro.com>
  • Kate Deplaix <kit-ty-kate@exn.st>
  • Roberto Di Cosmo <roberto@dicosmo.org>
  • Thomas Gazagnaire <thomas@gazagnaire.org>
  • Louis Gesbert <louis.gesbert@ocamlpro.com>
  • Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
  • Anil Madhavapeddy <anil@recoil.org>
  • Guillem Rieu <guillem.rieu@ocamlpro.com>
  • Ralf Treinen <ralf.treinen@pps.jussieu.fr>
  • Frederic Tuong <tuong@users.gforge.inria.fr>

πŸ¦‹ SEE ALSO πŸ¦‹

  • opam(1) β€” the mothership, the blueprint, the whole vibe 😌

πŸ› BUGS πŸ›

found a bug? don't just suffer in silence, go check the bug reports at https://github.com/ocaml/opam/issues πŸ’–


and that's the whole page bestie!! you made it to the end πŸŽ‰ this was OPAM-UPDATE(1) from Opam 2.6.1, and honestly? iconic behavior from you for reading the whole thing. go forth, update ur stuff, slay πŸ’… ✨ πŸ¦‹


πŸ“¦ where this page comes from