OPAM-ADMIN-CACHE(1)
π OPAM-ADMIN-CACHE(1) π
okay bestie, this is the page from the Opam admin Manual and it's all about opam admin-cache. no cap, it's the command that fills a local cache of package archives. let's go β¨
π NAME π
opam admin-cache β fills a local cache of package archives π
πΈ SYNOPSIS πΈ
opam admin cache [OPTION]β¦ [DIR]
π¦ DESCRIPTION π¦
okay so this one downloads the archives for all packages to fill a local cache. Then you can use that cache when you're serving the repository. it's giving "prep the stash so serving is cute later" πβ¨
π ARGUMENTS π
DIR(absent=~/opam/src/opam-full-2.6.1/_build/default/doc/man/cache)β the name of the cache directory to use. π
β OPTIONS β
these are the cache-specific options, bestie:
-c,--check-allβ run a full integrity check on the existing cache. If this is not set, only missing cache files are handled. π§-j JOBS,--jobs=JOBS(absent=8)β number of parallel downloads. π₯--link=DIRβ create reverse symbolic links to the archives withinDIR, in the formDIR/PKG.VERSION/FILENAME. πͺ-n,--no-repo-updateβ don't check, create or update the'repo'file to point to the generated cache (archive-mirrors:field). π ββοΈ
π«Ά COMMON OPTIONS π«Ά
these apply to every command, not just this one. π«
--best-effortβ don't fail if all requested packages can't be installed: try to install as many as possible. Heads up: not all external solvers may support this option (recent versions ofaspcudormccsshould). This is equivalent to setting the$OPAMBESTEFFORTenvironment variable. π«Ά--cli=MAJOR.MINOR(absent=2.6)β use the command-line interface syntax and semantics ofMAJOR.MINOR. 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. 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. π°οΈ--color=WHENβ colorize the output.WHENmust be one ofalways,neverorauto. π--confirm-level=LEVELβ 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 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 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 can be found athttp://www.dicosmo.org/Articles/usercriteria.pdf. π§--cudf=FILENAMEβ debug option: save 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 allows specifying the debug level (--debugsets it to1). Equivalent to setting$OPAMDEBUGto a positive integer. π--git-versionβ print the git version of opam, if set (i.e. you are using a development version), and exit. π±--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 extra pins required by packages that get pinned, either manually throughopam pinor throughopam install DIR. This is equivalent to settingIGNOREPINDEPENDS=true. π--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. π--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 usingopam admin upgrade [--mirror URL]when possible. π§-q,--quietβ disables--verbose. π€«--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 (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. π§©--strictβ fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. π¨--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). This is equivalent to setting$OPAMNOASPCUDor$OPAMUSEINTERNALSOLVER. π οΈ-v,--verboseβ be more verbose. One-vshows all package commands, repeat to also display commands called internally (e.g.tar,curl,patchetc.) Repeatingntimes is equivalent to setting$OPAMVERBOSEto"n". π£οΈ--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. 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. π-y,--yesβ answer yes to all opam yes/no questions without prompting. See also--confirm-level. This is equivalent to setting$OPAMYESto"true". π
πΈ ENVIRONMENT πΈ
okay bestie so opam reads a lot of environment variables, and this is the full guest list π
. Quick vibe check first: any variable that's a boolean β set it to "0", "no", "false" or the empty string to turn it off, and "1", "yes" or "true" to turn it on. That's the whole grammar, periodt.
OPAMALLPARENSβ surround all filters with parenthesis.OPAMASSUMEDEPEXTSβ see option--assume-depexts.OPAMAUTOANSWERβ internal use only. nothing to see here πOPAMAUTOREMOVEβ see the 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 is expected to maximise theopam-queryproperty in the solution.OPAMBUILDDOCβ Removed in 2.1. gone, girl πOPAMBUILDTESTβ Removed in 2.1. also gone.OPAMCLIβ see option--cli.OPAMCOLORβ when set toalwaysornever, sets a default value for the--coloroption.OPAMCONFIRMLEVELβ see option--confirm-level. heads up: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 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.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 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.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/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--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-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 astar.gzfiles (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. β οΈ yes this exists, yes it's a "trust me bro" button.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 thebuiltin-z3backend 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. bye π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. also bye π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. π« iconicOPAMVALIDATIONHOOKβ 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. seriously, don't π«Ά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 so this bit matters for literally every script 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. and honestly? blog posts or other documentation can benefit too, because 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.
lowkey the whole point: pin your CLI version now so future-you isn't debugging stale docs at 2am π
π₯ EXIT STATUS π₯
okay bestie this is the part everyone skips and then cries about later, so pay attention π
First up, a lil exception to literally everything below: the exec command returns 127 if the command was not found or couldn't be executed, and the command's exit value otherwise. iykyk π«Ά
Now the actual codes, no cap:
0β Success β¨ or true for boolean queries. we love a win.1β False. Returned when a boolean return value is expected, e.g. when running with--check, or for queries likeopam lint. it's giving "valid answer, just the sad one" π2β Bad command-line arguments, or command-line arguments pointing to an invalid context (e.g. file not following the expected format). read the docs babes.5β Not found. You requested something (package, version, repository, etc.) that couldn't be found. it's not there. it never was. π¦10β Aborted. The operation required confirmation, which wasn't given. you said no (or said nothing) π15β Could not acquire the locks required for the operation. something else is holding the door π20β There is no solution to the user request. This can be caused by asking to install two incompatible packages, for example. bestie they cannot coexist, pick one.30β Error in package definition, or other metadata files. Using--strictraises this error more often. the metadata is not slaying31β Package script error. Some package operations were unsuccessful. This may be an error in the packages or an incompatibility with your system. This can be a partial error.40β Sync error. Could not fetch some remotes from the network. This can be a partial error. the wifi said no πΈ50β Configuration error. Opam or system configuration doesn't allow operation, and needs fixing. fix ur setup queen π60β Solver failure. The solver failed to return a sound answer. It can be due to a broken external solver, or an error in solver configuration. the math girlies let us down π99β Internal error. Something went wrong, likely due to a bug in opam itself. not ur fault, fr fr β go report it π130β User interrupt.SIGINTwas received, generally due to the user pressing Ctrl+C. that was you. you did that. π
and then these ones, listed right after (they're a whole other vibe, honestly):
0β on success.123β on indiscriminate errors reported on standard error.124β on command line parsing errors.125β on unexpected internal errors (bugs).
lowkey memorise these and you'll never be confused by a random number in ur terminal again π
π FURTHER DOCUMENTATION π
See https://opam.ocaml.org/doc. that's it, that's the whole section β go read, it's iconic π₯
π AUTHORS π
these are the actual main characters who built this thing, put some respect on their names π«Ά
- 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 parent page, go say hi πΈ
π BUGS π
Check bug reports at https://github.com/ocaml/opam/issues. found something cursed? tell the girls, they'll fix it π
β¨ and that's the whole page bestie β¨ this one's Opam admin 2.6.1, filed under OPAM ADMIN-CACHE(1) β go forth and admin responsibly, mwah ππ
π¦ where this page comes from
- arch rolling: opam 2.6.1-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms