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 code0if there were any upstream changes, and1if 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: soopam update --upgrade --checkbehaves likeopam update && opam upgrade --check, returning0if 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--developmentor--repositories. team effort only.--developmentβ update development packages. and yes, it skips repositories unless--repositoriesis 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$OPAMJOBSenvironment variable.-R,--repositoriesβ update repositories, skipping development packages unless--developmentis also specified. same deal as above, just the other way around π-u,--upgradeβ automatically runsopam upgradeafter 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 ofaspcudormccsshould). It's 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.) β any version of opam in the sameMAJORseries will behave as for the specifiedMINORrelease. Important lore: this flag was not available in opam 2.0, so to select the 2.0 CLI, set theOPAMCLIenvironment variable to2.0instead of using this parameter π--color=WHENβ colorizes the output πWHENmust be one ofalways,neverorauto.--confirm-level=LEVELβ sets the confirmation level.LEVELmust be one ofask,no,yesorunsafe-yesπ Can be specified more than once. If--yesor--noare also given, the value of the last--confirm-levelis what counts. This is equivalent to setting$OPAMCONFIRMLEVEL.--criteria=CRITERIAβ specify your user preferences for dependency solving, just for this run. It overrides$OPAMCRITERIA,$OPAMFIXUPCRITERIAand$OPAMUPGRADECRITERIA. For the details on the supported language, and the external solvers available, seehttp://opam.ocaml.org/doc/External_solvers.html. A general guide to using solver preferences lives athttp://www.dicosmo.org/Articles/usercriteria.pdfπ--cudf=FILENAMEβ debug option, bestie: saves the CUDF requests sent to the solver toFILENAME-<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$OPAMDEBUGto"true".--debug-level=LEVELβ like--debug, but you get to pick the debug level (--debugsets it to1). Equivalent to setting$OPAMDEBUGto 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 formatFMT. The valueFMTmust be one ofauto,pager,grofforplain. Withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. the classic π--ignore-pin-dependsβ ignores extra pins required by packages that get pinned, whether manually throughopam pinor throughopam install DIR. Equivalent to settingIGNOREPINDEPENDS=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$OPAMJSONvariable.--noβ answers no to all opam yes/no questions without prompting. See also--confirm-level. Equivalent to setting$OPAMNOto"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 usingopam admin upgrade [--mirror URL]when possible π«Ά--no-self-upgradeβ opam will replace itself with a newer binary found atOPAMROOT/opamif present. This disables that behaviour. no glowy-up for opam today β-q,--quietβ disables--verbose. shhh π€«--root=ROOTβ useROOTas the current root path. Equivalent to setting$OPAMROOTtoROOT.--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$OPAMDEBUGvariable. 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 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}%. 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β useSWITCHas the current compiler switch. Equivalent to setting$OPAMSWITCHtoSWITCH.--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$OPAMNOASPCUDor$OPAMUSEINTERNALSOLVER.-v,--verboseβ be more verbose. One-vshows all package commands, repeat it to also display commands called internally (e.g.tar,curl,patchetc.) Repeating n times is equivalent to setting$OPAMVERBOSEto"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$OPAMYESto"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-effortoption is set, and it's expected to maximise theopam-queryproperty 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--coloroption.OPAMCONFIRMLEVELβ see option--confirm-level.OPAMCONFIRMLEVELhas priority overOPAMYESandOPAMNO. πOPAMCRITERIAβ specifies user preferences for dependency solving. The default value depends on the solver version, so 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 givencurlprogram. SeeOPAMFETCHfor more options.OPAMDEBUGβ see options--debugand--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. she digs, literally β¨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. she said my editor, not yours π«Ά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 thedownload-commandvalue from the main config file.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. 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--lockedand--lock-suffixoptions.OPAMLOGSβ logdir sets 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.OPAMNOAUTOUPGRADEβ disables automatic internal upgrade of repositories in an earlier format to the current one, onupdateorinit.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 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-checksumswhen 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. 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β (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)OPAMSTRICTβ 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.OPAMVALIDATIONHOOKβ if set, uses the%{hook}%command to validate an opam repository update.OPAMVERBOSEβ see option--verbose.OPAMVERBOSEONβ see option--verbose-onOPAMVERSIONLAGPOWERβ 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--yesand--confirm-level.OPAMYEShas priority overOPAMNOand is ignored ifOPAMCONFIRMLEVELis 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 π
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: theexeccommand does NOT play by the rules below. It returns127if 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 π ortruefor boolean queries.1βFalse. shows up when a boolean return value is expected, like when you're running with--check, or for queries likeopam 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--strictraises 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.SIGINTwas 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
- 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