OPAM-UPGRADE(1)

OPAM-UPGRADE(1) ๐Ÿ’–

okay bestie, welcome to the Opam Manual โ€” this is the page for opam-upgrade, and it's a whole main-character moment. grab a boba, we're going through E V E R Y T H I N G โœจ


๐ŸŒธ NAME ๐ŸŒธ

opam-upgrade โ€” upgrade the installed package to latest version. that's it, that's the vibe ๐Ÿ’…


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

opam upgrade [OPTION]โ€ฆ [PACKAGES]โ€ฆ

โœจ DESCRIPTION โœจ

so what this does is: it upgrades your installed packages to their latest available versions. lowkey iconic. ๐Ÿซถ

more precisely โ€” and this is the part you wanna actually remember โ€” the command calls the dependency solver to find a consistent state where most of the installed packages get upgraded to their latest versions. consistency stays winning, periodt.

and okay, plot twist: if you hand it a directory as an argument, then anything that's pinned to that directory gets selected for upgrade. cute. โœจ


๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • PACKAGES โ€” a list of package names, each optionally with a version or a constraint, like pkg, pkg.1.0 or pkg>=0.5 ; or directory names containing a package description, given with an explicit directory (like ./srcdir or .). yes you can just raw-dog it with pkg and let opam figure it out, obsessed. ๐Ÿ’–

๐Ÿ’… OPTIONS ๐Ÿ’…

  • -a, --all โ€” run an upgrade of all installed packages. this is literally the default when you don't pass PACKAGES, and it's still useful alongside PACKAGES when you wanna upgrade but also make sure some packages get (or stay) installed. no cap. ๐Ÿ”ฅ
  • --check โ€” don't actually run the upgrade, just check if anything could be upgraded. returns 0 if yes there's stuff to upgrade, 1 if there's nothing that can be upgraded. it's giving vibe check but for packages. ๐Ÿ‘‘
  • --fixup โ€” recover from a broken state (eg. missing dependencies, two conflicting packages installed together...). we've all been there bestie, no judgment. ๐Ÿฉน
  • --formula=FORMULA (absent=[]) โ€” Experimental. specify a dependency formula to be verified by the solution, on top of the switch invariant. the format is the same as for expressing dependencies in package definition files, e.g. "foo" {>= "1.1"} ๐Ÿงช
  • --installed โ€” when a directory is provided as argument, don't install pinned packages that aren't yet installed. we're only touching what's already here, tysm. ๐Ÿ™…โ™€๏ธ
  • --recursive โ€” allow recursive lookups of *.opam files. cf. --subpath also. go deeper. ๐ŸŒŠ
  • --subpath=PATH โ€” *.opam files are retrieved from the given sub directory instead of the top directory. sources are then taken from the targeted sub directory, and internally only this subdirectory is copied/fetched. it can be combined with --recursive to have a recursive lookup on the subpath. nesting levels: iconic. ๐Ÿช†

๐Ÿ› ๏ธ PACKAGE BUILD OPTIONS ๐Ÿ› ๏ธ

  • --assume-depexts โ€” skip the installation step for any missing system packages, and attempt to proceed with compilation of the opam packages anyway. if the installation is successful, opam won't prompt again about these system packages. only meaningful if external dependency handling is enabled. โœจ
  • -b, --keep-build-dir โ€” keep the build directories after compiling packages. this is equivalent to setting $OPAMKEEPBUILDDIR to "true". clingy in the best way. ๐Ÿซถ
  • --build-doc โ€” Removed in 2.1, use --with-doc instead. she's gone, bestie. โšฐ๏ธ
  • --build-test โ€” Removed in 2.1, use --with-test instead. also gone. ๐Ÿชฆ
  • -d, --with-doc โ€” build the package documentation. this only affects packages listed on the command-line. this is equivalent to setting $OPAMWITHDOC (or the deprecated $OPAMBUILDDOC) to "true". ๐Ÿ“š
  • --dry-run โ€” simulate the command, but don't actually perform any changes. this also can be set with environment variable $OPAMDEBUG. manifesting without committing, we love to see it. ๐Ÿ”ฎ
  • --fake โ€” this option registers the actions into the opam database, without actually performing them.
WARNING: this option is dangerous and likely to break your opam environment. you probably want --dry-run. you've been warned. ๐Ÿ’€
  • --ignore-available-on[=PACKAGES] (default=) โ€” forces opam to mark the listed packages as available. this can be used to test compatibility, but expect builds to break when using this. note that version constraints of the packages' dependencies are unaffected. ๐Ÿ™ˆ
  • --ignore-constraints-on[=PACKAGES] (default=) โ€” forces opam to ignore version constraints on all dependencies to the listed packages. this can be used to test compatibility, but expect builds to break when using this. note that availability of the packages as well as version constraints on optional dependencies and conflicts are unaffected. this is equivalent to setting $OPAMIGNORECONSTRAINTS. ๐Ÿ”ฅ
  • --inplace-build โ€” when compiling a package which has its source bound to a local directory, process the build and install actions directly in that directory, rather than in a clean copy handled by opam. this only affects packages that are explicitly listed on the command-line. this is equivalent to setting $OPAMINPLACEBUILD to "true". ๐Ÿ 
  • -j JOBS, --jobs=JOBS โ€” set the maximal number of concurrent jobs to use. the default value is calculated from the number of cores. you can also set it using the $OPAMJOBS environment variable. multitasking queen. ๐Ÿ‘‘
  • --lock-suffix=SUFFIX (absent=locked) โ€” set locked files suffix to SUFFIX. ๐Ÿ”
  • --locked โ€” in commands that use opam files found from pinned sources, if a variant of the file with an added .locked extension is found (e.g. foo.opam.locked besides foo.opam), that will be used instead. this is typically useful to offer a more specific set of dependencies and reproduce similar build contexts, hence the name. the lock option can be used to generate such files, based on the versions of the dependencies currently installed on the host. this is equivalent to setting the $OPAMLOCKED environment variable. note that this option doesn't generally affect already pinned packages. ๐Ÿ”’
  • -m MAKE, --make=MAKE โ€” Removed in 2.1, use opam config set[-global] make MAKE instead. another one bites the dust. ๐Ÿ’€
  • --no-checksums โ€” do not verify the checksum of downloaded archives. this is equivalent to setting $OPAMNOCHECKSUMS to "true". living dangerously fr fr. ๐Ÿ˜ญ
  • --no-depexts โ€” temporarily disables handling of external dependencies. this can be used if a package is not available on your system package manager, but you installed the required dependency by hand. implies --assume-depexts, and stores the exceptions upon success as well. DIY energy. ๐Ÿงš
  • --require-checksums โ€” reject the installation of packages that don't provide a checksum for the upstream archives. this is equivalent to setting $OPAMREQUIRECHECKSUMS to "true". we do NOT accept mystery boxes here. ๐Ÿšซ
  • --reuse-build-dir โ€” reuse existing build directories (kept by using --keep-build-dir), instead of compiling from a fresh clone of the source. this can be faster, but also lead to failures if the build systems of the packages don't handle upgrades of dependencies well. this is equivalent to setting $OPAMREUSEBUILDDIR to "true". โšก
  • --show-actions โ€” call the solver and display the actions. don't perform any changes. this is equivalent to setting $OPAMSHOW. just here to observe, main character spectator energy. ๐Ÿ‘€
  • --skip-updates โ€” when running an install, upgrade or reinstall on source-pinned packages, they are normally updated from their origin first. this flag disables that behaviour and will keep them to their version in cache. this is equivalent to setting $OPAMSKIPUPDATE. no peeking at the origin, we're staying home. ๐Ÿก
  • -t, --with-test โ€” build and run the package unit-tests. this only affects packages listed on the command-line. this is equivalent to setting $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true". test or it didn't happen. ๐Ÿงช
  • --unlock-base โ€” Removed in 2.1, use --update-invariant instead. she's retired bestie. ๐Ÿ’…
  • --update-invariant โ€” allow changes to the packages set as switch base (typically, the main compiler). use with caution. this is equivalent to setting the $OPAMUNLOCKBASE environment variable. ๐Ÿ”“
  • --verbose-on=PACKAGES โ€” be more verbose on specific packages. this is equivalent to setting $OPAMVERBOSE. ๐Ÿ—ฃ๏ธ
  • --with-dev-setup โ€” include development tools only dependencies. dev tools get to come to the party too. ๐ŸŽ‰

โœจ COMMON OPTIONS โœจ

okay bestie, these ones are the communal wardrobe of opam โ€” every single command gets to wear them. ๐Ÿ’– No cap.

  • --best-effort โ€” Don't fail if all requested packages can't be installed: try to install as many as possible. Note that not all external solvers may support this option (recent versions of aspcud or mccs should). This is equivalent to setting the $OPAMBESTEFFORT environment variable. like, it's the "we take those" of package installs ๐Ÿ’…
  • --cli=MAJOR.MINOR (absent=2.6) โ€” Use the command-line interface syntax and semantics of MAJOR.MINOR. 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. The 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. time travel but make it CLI-compatible โœจ
  • --color=WHEN โ€” Colorize the output. WHEN must be one of always, never or auto. yes, aesthetic matters even in the terminal ๐ŸŒˆ
  • --confirm-level=LEVEL โ€” 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 taken into account. This is equivalent to setting $OPAMCONFIRMLEVEL. and yes, unsafe-yes is giving exactly what it sounds like ๐Ÿ‘€
  • --criteria=CRITERIA โ€” Specify user preferences for dependency solving for this run. Overrides $OPAMCRITERIA, $OPAMFIXUPCRITERIA and $OPAMUPGRADECRITERIA. For 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 can be found at http://www.dicosmo.org/Articles/usercriteria.pdf. solver vibes are customizable, we love to see it ๐Ÿ’œ
  • --cudf=FILENAME โ€” Debug option: Save 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. for the debug girlies who love receipts ๐Ÿงพ
  • --debug โ€” Print debug message to stderr. This is equivalent to setting $OPAMDEBUG to "true". spill the tea to stderr ๐Ÿซ–
  • --debug-level=LEVEL โ€” Like --debug, but allows specifying the debug level (--debug sets it to 1). Equivalent to setting $OPAMDEBUG to a positive integer. debug but with range, main character energy ๐Ÿ’–
  • --git-version โ€” Print the git version of opam, if set (i.e. you are using a development version), and exit. dev build reveal, icon behavior ๐ŸŽ€
  • --help[=FMT] (default=auto) โ€” Show 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. not the TERM being dumb, bestie ๐Ÿ˜ญ
  • --ignore-pin-depends โ€” Ignore extra pins required by packages that get pinned, either manually through opam pin or through opam install DIR. This is equivalent to setting IGNOREPINDEPENDS=true. pins? don't know her today ๐Ÿ’…
  • --json=FILENAME โ€” Save the results of the opam run in 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. for when you need the data in JSON format, periodt ๐Ÿ“Š
  • --no โ€” Answer no to all opam yes/no questions without prompting. See also --confirm-level. This is equivalent to setting $OPAMNO to "true". no means no, and it means it automatically ๐Ÿ™…โ€โ™€๏ธ
  • --no-aspcud โ€” Removed in 2.1. gone, deleted, she's not coming to the function ๐Ÿ’€
  • --no-auto-upgrade โ€” When configuring or updating a repository that is written for an earlier opam version (1.2), opam internally converts it to the current format. This disables this behaviour. Note that repositories should define their format version in a 'repo' file at their root, or they will 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. manual upgrade era, do it with intention โœจ
  • --no-self-upgrade โ€” Opam will replace itself with a newer binary found at OPAMROOT/opam if present. This disables this behaviour. not me swapping my own binary without asking ๐Ÿ’…
  • -q, --quiet โ€” Disables --verbose. shhh, we're being lowkey ๐Ÿคซ
  • --root=ROOT โ€” Use ROOT as the current root path. This is equivalent to setting $OPAMROOT to ROOT. pick your root, own your root ๐ŸŒฑ
  • --safe, --readonly โ€” Make sure nothing will be automatically updated or rewritten. Useful for calling from completion scripts, for example. Will fail whenever such an operation is needed ; also avoids waiting for locks, skips interactive questions and overrides the $OPAMDEBUG variable. This is equivalent to set environment variable $OPAMSAFE. read-only queen, no surprise edits ๐Ÿ›ก๏ธ
  • --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}%. This is equivalent to setting $OPAMEXTERNALSOLVER. choose your solver fighter โš”๏ธ
  • --strict โ€” Fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. strict mode: no silent chaos allowed ๐Ÿ™ˆ
  • --switch=SWITCH โ€” Use SWITCH as the current compiler switch. This is equivalent to setting $OPAMSWITCH to SWITCH. switch it up, compiler edition ๐Ÿฆ‹
  • --use-internal-solver โ€” Disable any external solver, and use the built-in one (this requires that opam has been compiled with a built-in solver). This is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER. homegrown solver, no outside opinions ๐Ÿ’œ
  • -v, --verbose โ€” Be more verbose. One -v shows all package commands, repeat to also display commands called internally (e.g. tar, curl, patch etc.) Repeating n times is equivalent to setting $OPAMVERBOSE to "n". verbose? more like yappuccino โ˜•
  • --version โ€” Show version information. the classic "who am I" moment ๐Ÿ’…
  • -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. As source directory is copied as it is, if it isn't clean it may result on a opam build failure. This only affects packages explicitly listed on the command-line. It can also be set with $OPAMWORKINGDIR. working dir realness, but keep it clean bestie ๐Ÿงผ
  • -y, --yes โ€” Answer yes to all opam yes/no questions without prompting. See also --confirm-level. This is equivalent to setting $OPAMYES to "true". yes queen, say yes to everything ๐Ÿ‘‘

๐ŸŒ ENVIRONMENT ๐ŸŒ

okay bestie listen up ๐Ÿ’– opam is so into your environment variables. it reads a whole bunch of them, and they're basically your backstage passes to changing how opam acts without touching a single config file. iconic behavior tbh.

quick vocab check before we dive in โœจ โ€” for the boolean ones, you turn them off by setting them to "0", "no", "false" or the empty string. you turn them on with "1", "yes" or "true". that's the whole vibe check, no cap ๐Ÿซถ

  • OPAMALLPARENS โ€” surround all filters with parenthesis.
  • OPAMASSUMEDEPEXTS โ€” see option --assume-depexts.
  • OPAMAUTOANSWER โ€” internal use only. ๐Ÿคซ
  • 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 is expected to maximise the opam-query property in the solution.
  • OPAMBUILDDOC โ€” Removed in 2.1. ๐Ÿ’€ rip
  • OPAMBUILDTEST โ€” Removed in 2.1. also gone, also rip
  • OPAMCLI โ€” see option --cli.
  • OPAMCOLOR โ€” when set to always or never, sets a default value for the --color option.
  • OPAMCONFIRMLEVEL โ€” see option --confirm-level. also heads up: OPAMCONFIRMLEVEL has priority over OPAMYES and OPAMNO. it's the main character here ๐Ÿ‘‘
  • OPAMCRITERIA โ€” specifies user preferences for dependency solving. the default value depends on the solver version, so run config report if you wanna 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.
  • OPAMDOWNLOADJOBS โ€” sets the maximum number of simultaneous downloads. multitasking queen ๐Ÿฆ‹
  • 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, and it overrides $EDITOR and $VISUAL.
  • OPAMERRLOGLEN โ€” sets the number of log lines printed when a sub-process fails. 0 means print all of them. ๐Ÿ˜ญ
  • 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.
  • 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. very forensic of you ๐Ÿงš
  • 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. lowkey witchcraft โœจ
  • 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.
  • 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. ๐Ÿ’€ another one gone
  • 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. ๐Ÿช so cute
  • 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. ๐Ÿ’€ just don't, bestie
  • 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 so this one matters, bestie. 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. additionally, blog posts or other documentation can benefit, as it prevents information from becoming stale. periodt. ๐Ÿ“Œ

even though opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. slay ๐Ÿ’…

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. ๐Ÿ‘€ so if you see a warning, that's why, don't panic

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. last one wins, fr fr ๐ŸŒธ

โœจ EXIT STATUS โœจ

Okay bestie, this is the part where opam tells you what happened using numbers instead of words, iykyk ๐Ÿ’…

โš ๏ธ One exception to literally everything below: the exec command returns 127 if the command wasn't found or couldn't be executed, and returns the command's own exit value otherwise. That one plays by its own rules, no cap.
  • 0 โ€” Success! Or true for boolean queries. ๐ŸŽ‰
  • 1 โ€” False. You get this 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 at an invalid context (for example, a file that doesn't follow the expected format).
  • 5 โ€” Not found. You asked for something (a package, a version, a repository, whatever) and it simply wasn't there. ๐Ÿ˜ญ
  • 10 โ€” Aborted. The operation needed confirmation and it wasn't given. ๐Ÿ™ˆ
  • 15 โ€” Could not acquire the locks required for the operation.
  • 20 โ€” There's no solution to what you asked for. This can happen when you ask to install two incompatible packages, for example.
  • 30 โ€” Error in package definition, or other metadata files. Using --strict raises this error more often. ๐Ÿ‘€
  • 31 โ€” Package script error. Some package operations were unsuccessful. This might be an error in the packages, or an incompatibility with your system. It can be a partial error.
  • 40 โ€” Sync error. Couldn't fetch some remotes from the network. This can be a partial error too.
  • 50 โ€” Configuration error. Opam or your 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 because of a broken external solver, or an error in the solver configuration.
  • 99 โ€” Internal error. Something went wrong, and it's probably a bug in opam itself. ๐Ÿ’€
  • 130 โ€” User interrupt. SIGINT was received, which is generally because the user pressed Ctrl+C.

And then a lil bonus trio, because why not:

  • 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 ๐ŸŒˆ

See https://opam.ocaml.org/doc. That's the spot for the deep lore, bestie ๐Ÿ“šโœจ


๐Ÿ‘‘ AUTHORS ๐Ÿ‘‘

The absolute icons who made this happen, in the order they're listed:

  • 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 main character, go read it ๐Ÿซถ

๐Ÿ› BUGS ๐Ÿ›

Check bug reports at https://github.com/ocaml/opam/issues. Found something cursed? Tell them, don't suffer in silence ๐Ÿ’–


And that's a wrap on this page, bestie! ๐ŸŽ€ It's Opam 2.6.1 talking to you through the OPAM-UPGRADE(1) page, and that's the whole thing โ€” every single line, no skips, no shortcuts. Go upgrade something and slay ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from