OPAM-ADMIN-UPGRADE(1)
๐ OPAM-ADMIN-UPGRADE ๐
okay bestie, welcome to the Opam admin Manual corner of the internet โจ this is OPAM-ADMIN-UPGRADE(1) and she is THAT girl, so let's get into it ๐
๐ฆ NAME ๐ฆ
opam admin-upgrade โ upgrades your repository from earlier opam versions, no cap ๐
โจ SYNOPSIS โจ
opam admin upgrade [--clear-cache] [--mirror=URL] [OPTION]โฆ
๐ธ DESCRIPTION ๐ธ
okay so here's the vibe: this command reads repositories from earlier opam versions and converts them into repositories that are suitable for the current opam version. glow-up arc fr fr ๐ซถ
packages might get created or renamed โ that's just part of the process, don't panic โ and any compilers defined in the old format (that's the compilers/ directory, iykyk) will be turned into packages, using a pre-defined hierarchy that assumes OCaml compilers. iconic behavior honestly ๐
๐ OPTIONS ๐
--clear-cacheโ cut from the squad in 2.6. she's gone bestie, removed, archived, no longer invited ๐-m URL,--mirror=URLโ this one is the main character of the section ๐ don't overwrite the current repository! instead, put an upgraded mirror in place in a subdirectory, with proper redirections and everything. but listen โ you need the URL the repository will be served from, because that URL goes into the redirects. why? because older versions of opam literally do not understand relative redirects ๐ญ like they just can't, so the URL is non-negotiable.
๐ COMMON OPTIONS ๐
these options are common to all commands โ they're the group chat that's in every conversation, always there, always relevant ๐
--best-effortโ don't fail if all requested packages can't be installed; just try to install as many as possible. heads up: not all external solvers may support this option (recent versions ofaspcudormccsshould, bestie, they're the good ones ๐ ). this is equivalent to setting the$OPAMBESTEFFORTenvironment variable.--cli=MAJOR.MINOR(absent=2.6) โ use the command-line interface syntax and semantics ofMAJOR.MINOR. this is intended for any persistent use of opam (scripts, blog posts, etc.), and any version of opam in the sameMAJORseries will behave as for the specifiedMINORrelease. important lore alert ๐ข the flag was not available in opam 2.0, so to select the 2.0 CLI, set theOPAMCLIenvironment variable to2.0instead of using this parameter. iykyk ๐ง--color=WHENโ colorize the output ๐WHENmust be one ofalways,neverorauto.--confirm-level=LEVELโ confirmation level, andLEVELmust be one ofask,no,yesorunsafe-yes. can be specified more than once. if--yesor--noare also given, the value of the last--confirm-levelis taken into account. this is equivalent to setting$OPAMCONFIRMLEVEL.--criteria=CRITERIAโ specify user preferences for dependency solving for this run. overrides$OPAMCRITERIA,$OPAMFIXUPCRITERIAand$OPAMUPGRADECRITERIA. for the deets on the supported language, and the external solvers available, seehttp://opam.ocaml.org/doc/External_solvers.html. and a general guide to using solver preferences can be found athttp://www.dicosmo.org/Articles/usercriteria.pdf๐--cudf=FILENAMEโ debug option, so it's giving investigator energy ๐ it saves the CUDF requests sent to the solver toFILENAME-<n>.cudfwhere<n>is the n-th call to the solver during the opam run.--debugโ print debug message to stderr. this is equivalent to setting$OPAMDEBUGto"true".--debug-level=LEVELโ like--debug, but it lets you specify the debug level (and--debugjust sets it to1). equivalent to setting$OPAMDEBUGto a positive integer.--git-versionโ print the git version of opam, if it's set (i.e. you're using a development version), and exit. flex if you've got it โจ--help[=FMT](default=auto) โ show this help in formatFMT. the valueFMTmust be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined.--ignore-pin-dependsโ ignore the extra pins required by packages that get pinned, either manually throughopam pinor throughopam install DIR. this is equivalent to settingIGNOREPINDEPENDS=true. let it go bestie ๐--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$OPAMJSONvariable.--noโ answer no to all opam yes/no questions without prompting. see also--confirm-level. this is equivalent to setting$OPAMNOto"true".--no-aspcudโ removed in 2.1. yeah, she left the chat in 2.1, rest in peace ๐--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 that behaviour. note: repositories should define their format version in arepofile 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 usingopam admin upgrade [--mirror URL]when possible. manual is the move fr fr ๐ซถ-q, --quietโ disables--verbose. shhh ๐คซ--root=ROOTโ useROOTas the current root path. this is equivalent to setting$OPAMROOTtoROOT.--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$OPAMDEBUGvariable. this is equivalent to set environment variable$OPAMSAFE.--solver=CMDโ specify the CUDF solver to use for resolving package installation problems. this is either a predefined solver โ and this version of opam supportsbuiltin-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. solver variety is the spice of life ๐--strictโ fail whenever an error is found in a package definition or a configuration file. the default is to continue silently if possible. choose chaos or choose peace, bestie ๐--switch=SWITCHโ useSWITCHas the current compiler switch. this is equivalent to setting$OPAMSWITCHtoSWITCH.--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, so check that first ๐). this is equivalent to setting$OPAMNOASPCUDor$OPAMUSEINTERNALSOLVER.-v, --verboseโ be more verbose. one-vshows all package commands, and you can repeat it to also display commands called internally (e.g.tar,curl,patchetc.) โ repeating n times is equivalent to setting$OPAMVERBOSEto"n". the more v's the more lore ๐ฃ๏ธ--versionโ show 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 on a opam build failure ๐ญ this only affects packages explicitly listed on the command-line. it can also be set with$OPAMWORKINGDIR.-y, --yesโ answer yes to all opam yes/no questions without prompting. see also--confirm-level. this is equivalent to setting$OPAMYESto"true". yes queen, consent given in advance ๐
๐ฑ ENVIRONMENT ๐ฑ
okay so opam reads a ton of environment variables and honestly bestie, this is the whole list. big one first: boolean variables โ set them to "0", "no", "false" or the empty string to disable, and "1", "yes" or "true" to enable. that's the whole vibe check, no cap ๐
OPAMALLPARENSโ surround all filters with parenthesis.OPAMASSUMEDEPEXTSโ see option `--assume-depexts'.OPAMAUTOANSWERโ internal use only. nothing to see here ๐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 theopam-query' property in the solution.OPAMBUILDDOCโ Removed in 2.1.OPAMBUILDTESTโ Removed in 2.1.OPAMCLIโ see option `--cli'.OPAMCOLORโ when set toalwaysornever, sets a default value for the `--color' option.OPAMCONFIRMLEVELโ see option--confirm-level.OPAMCONFIRMLEVELhas priority overOPAMYESandOPAMNO.OPAMCRITERIAโ specifies user preferences for dependency solving. The default value depends on the solver version, useconfig reportto know the current setting. See also option--criteria.OPAMCUDFFILEโ save the cudf graph tofile-actions-explicit.dot.OPAMCUDFTRIMโ controls the filtering of unrelated packages during CUDF preprocessing.OPAMCURLโ can be used to select a given 'curl' program. SeeOPAMFETCHfor 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:2orCLIENT 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.OPAMDROPWORKINGDIRโ overrides packages previously updated with--working-diron 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$EDITORand$VISUAL.OPAMERRLOGLENโ sets the number of log lines printed when a sub-process fails.0to print all.OPAMEXTERNALSOLVERโ see option `--solver'.OPAMFAKEโ see option `--fake'.OPAMFETCHโ specifies how to download files: eitherwget,curlor a custom command where variables%{url}%,%{out}%,%{retry}%,%{compress}%and%{checksum}%will be replaced. Overrides the 'download-command' value from the main config file. so many lil placeholders, it's giving mad libs ๐OPAMFIXUPCRITERIAโ same asOPAMUPGRADECRITERIA, 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. โจ parallel slay โจ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--lockedand--lock-suffixoptions.OPAMLOGSโlogdirsets log directory, default is a temporary directory in/tmpOPAMMAKECMDโ set the system make command to use.OPAMMERGEOUTโ merge process outputs, stderr on stdout.OPAMNOโ answer no to any question asked, see options--noand--confirm-level.OPAMNOis ignored if eitherOPAMCONFIRMLEVELorOPAMYESis set.OPAMNOAGGREGATEโ withopam admin check, don't aggregate packages.OPAMNOASPCUDโ Deprecated. โ ๏ธ old news bestieOPAMNOAUTOUPGRADEโ disables automatic internal upgrade of repositories in an earlier format to the current one, on 'update' or 'init'.OPAMNOCHECKSUMSโ enables option--no-checksumswhen available.OPAMNODEPEXTSโ disables system dependencies handling, see option `--no-depexts'.OPAMNOENVNOTICEโ Internal.OPAMNOSELFUPGRADEโ see option--no-self-upgradeOPAMPINKINDAUTOโ 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 tofalseto 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. foropam install').OPAMRETRIESโ sets the number of tries before failing downloads.OPAMREUSEBUILDDIRโ see option `--reuse-build-dir'.OPAMROOTโ see option--root'. This is automatically set byopam 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. bestie do NOT ship this to prod ๐ญOPAMSOLVERALLOWSUBOPTIMALโ (defaulttrue) 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. Iftrue, opam will continue with a warning, iffalsea timeout is an error. Currently only the builtin-z3 backend handles this degraded case.OPAMSOLVERTIMEOUTโ change the time allowance of the solver. Default is60.0, set to0for 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 from0.0(best solution known to the solver) to1.0(unoptimized solution). Default is0.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 ofalways,neverorauto) ๐ it's watchingOPAMSTRICTโ fail on inconsistencies (file reading, switch import, etc.).OPAMSWITCHโ see option--switch'. Automatically set byopam env --switch=SWITCH --set-switch'.OPAMUNLOCKBASEโ see install option `--unlock-base'.OPAMUPGRADECRITERIAโ specifies user preferences for dependency solving when performing an upgrade. OverridesOPAMCRITERIAin 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 ofalways,neverorauto). By defaultauto, which is determined from the locale).OPAMUTF8MSGSโ use extended UTF8 characters (camels) in opam messages. ImpliesOPAMUTF8. This is set by default on macOS only. ๐ช๐ช iconic honestlyOPAMVALIDATIONHOOKโ if set, uses the%{hook}%command to validate an opam repository update.OPAMVERBOSEโ see option `--verbose'.OPAMVERBOSEONโ see option--verbose-onOPAMVERSIONLAGPOWERโ do not use. ๐ literally just don'tOPAMWITHDEVSETUPโ 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.OPAMYEShas priority overOPAMNOand is ignored ifOPAMCONFIRMLEVEL` is set.OPAMVAR_var โ overrides the contents of the variable var when substituting%{var}%strings inopamfiles.OPAMVAR_package_var โ overrides the contents of the variable package:var when substituting%{package:var}%strings inopamfiles.
๐ฆ CLI VERSION ๐ฆ
bestie this section is IMPORTANT so pls don't skim ๐ซถ
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.
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. โจ last one wins, main character energy โจ
๐ฆ EXIT STATUS ๐ฆ
okay bestie, listen up โ the exit code is literally the receipts ๐ every time you run opam, it whispers a number back to your shell, and that number tells you exactly what went down. here's the decoder ring โจ
โ ๏ธ one exception, and it's a big one: theexeccommand does NOT play by these rules. if the command wasn't found or couldn't be executed, it returns127. otherwise, it hands you back the command's own exit value. periodt.
0โ success! ๐ ortruefor boolean queries. she ate.1โ false. you get this when a boolean return value is expected โ like when you're running with--check, or for queries likeopam lint. it's not an error, it's just a no ๐2โ bad command-line arguments, or arguments pointing at an invalid context (e.g. a file that doesn't follow the expected format). your typing gave, unfortunately ๐ญ5โ not found. you asked for something (a package, a version, a repository, etc.) and it simply does not exist. ghosted fr ๐ซฅ10โ aborted. the operation needed confirmation and you didn't give it. you said no, or you justโฆ didn't say yes ๐15โ could not acquire the locks required for the operation. someone else is holding the keys ๐20โ there's no solution to your request. like asking to install two incompatible packages, for example. the audacity ๐30โ error in package definition, or other metadata files. using--strictraises this error more often. sensitive much? โจ31โ package script error. some package operations were unsuccessful. could be an error in the packages themselves, or an incompatibility with your system. and heads up โ this can be a partial error ๐40โ sync error. couldn't fetch some remotes from the network. also can be a partial error ๐ก50โ configuration error. opam or your system config doesn't allow the operation, and it needs fixing. bestie, go fix it ๐60โ solver failure. the solver failed to return a sound answer. could be a broken external solver, or an error in solver configuration. the math said no ๐งฎ99โ internal error. something went wrong, likely due to a bug in opam itself. not your fault, bestie, blame the code ๐130โ user interrupt.SIGINTwas received โ generally because you pressed Ctrl+C. you panicked, it's fine, we've all been there ๐ญ
and then there's this little trio, which means what it says on the tin:
0โ on success. (yes again, iconic consistency ๐)123โ on indiscriminate errors reported on standard error.124โ on command line parsing errors.125โ on unexpected internal errors (bugs).
๐ FURTHER DOCUMENTATION ๐
want more lore? the full docs live at https://opam.ocaml.org/doc. go read, she's worth it ๐
๐ AUTHORS ๐
giving credit where credit is due, because these legends built the thing ๐ซถ
- 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 admin(1) โ the main character of this whole saga ๐
๐ BUGS ๐
found something cursed? check the bug reports at https://github.com/ocaml/opam/issues โ don't suffer in silence, bestie ๐
and that's a wrap on OPAM ADMIN-UPGRADE(1) ๐ โ this one's from Opam admin 2.6.1, dated the day the manpage was written โจ go forth and upgrade responsibly, you absolute icon ๐๐ฆ
๐ฆ where this page comes from
- arch rolling: opam 2.6.1-1 ยท LGPL-2.1-only
- fedora 44: opam 2.6.1-1.fc44 ยท LGPL-2.1-only WITH OCaml-LGPL-linking-exception
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms