OPAM-ADMIN-INDEX(1)
๐ธ OPAM-ADMIN-INDEX ๐
okay bestie, you found it โ the Opam admin Manual page for opam admin index, and she is long, so buckle up. This is part 1 of 3, so don't go anywhere. ๐ซถ
โจ NAME โจ
opam admin-index โ Generate an inclusive index file for serving over HTTP.
โจ SYNOPSIS โจ
opam admin index [--full-urls-txt] [--minimal-urls-txt] [--no-urls-txt]
[OPTION]โฆ
๐ฆ DESCRIPTION ๐ฆ
So here's the vibe ๐ โ you can serve an opam repository over HTTP or HTTPS using literally any web server. Iconic. But to do that, you've gotta generate an inclusive index first, and that's the whole job of this command. It spits out the files the opam client will be expecting when it fetches from an HTTP remote. ๐
โ ๏ธ bestie listen: you have to run this after any changes are made to the contents of the repository. No exceptions, fr fr.
๐ OPTIONS ๐
--full-urls-txtโ generates an inclusiveurls.txt, for repositories that are gonna be used by opam versions earlier than 2.0. Old-school, but she serves. ๐--minimal-urls-txtโ generates a minimalurls.txtfile that only includes therepofile. This lets opam versions earlier than 2.0 read that file and get properly redirected to a repository made just for their version (assuming a suitableredirect:field is defined) instead of justโฆ failing. ๐ญ This is the default.--no-urls-txtโ don't generate aurls.txtfile at all. Like, that index file is no longer needed from opam 2.0 onward, but older versions still use it. So it's giving legacy. ๐
๐ COMMON OPTIONS ๐
These ones are common to all commands, so they're the shared friend group of the opam CLI. ๐ซถ
--best-effortโ don't fail if all the requested packages can't be installed: just try to install as many as possible. ngl, not every external solver supports this (recent versions ofaspcudormccsshould though). Equivalent to setting the$OPAMBESTEFFORTenvironment variable. โจ--cli=MAJOR.MINOR(absent=2.6) โ use the command-line interface syntax and semantics ofMAJOR.MINOR. This is for any persistent use of opam (scripts, blog posts, etc.), so any version of opam in the sameMAJORseries will behave as for the specifiedMINORrelease. Heads up though: this flag wasn't available in opam 2.0, so to select the 2.0 CLI you gotta 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, whereLEVELmust be one ofask,no,yesorunsafe-yes. Can be specified more than once. If--yesor--noare also given, the value of the last--confirm-levelis the one that counts. Equivalent to setting$OPAMCONFIRMLEVEL. โญ--criteria=CRITERIAโ specify user preferences for dependency solving for this run. Overrides$OPAMCRITERIA,$OPAMFIXUPCRITERIAand$OPAMUPGRADECRITERIA. For deets on the supported language and the external solvers available, peephttp://opam.ocaml.org/doc/External_solvers.html. And a general guide to using solver preferences lives athttp://www.dicosmo.org/Articles/usercriteria.pdf. ๐--cudf=FILENAMEโ debug option, bestie: 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 messages tostderr. Equivalent to setting$OPAMDEBUGto"true". ๐--debug-level=LEVELโ like--debug, but lets you specify the debug level (--debugsets 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. ๐--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, whether manually throughopam pinor throughopam install DIR. Equivalent to settingIGNOREPINDEPENDS=true.--json=FILENAMEโ save the results of the opam run into a computer-readable file. If the filename contains the character%, it gets 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. Equivalent to setting$OPAMNOto"true".--no-aspcudโ Removed in 2.1. ๐--no-auto-upgradeโ when configuring or updating a repository that's 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 arepofile at their root, or they'll be assumed to be in the older format. And honestly? It's preferable in any case to upgrade the repositories manually usingopam admin upgrade [--mirror URL]when possible. ๐-q,--quietโ disables--verbose. ๐คซ--root=ROOTโ useROOTas the current root path. Equivalent to setting$OPAMROOTtoROOT.--safe,--readonlyโ make sure nothing gets 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. ๐ก๏ธ--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. (Yes, the default is chill. This flag is the opposite of chill.)--switch=SWITCHโ useSWITCHas the current compiler switch. 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). 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,patch, etc.). Repeating n times 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're pointing to. And since 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โ answer yes to all opam yes/no questions without prompting. See also--confirm-level. Equivalent to setting$OPAMYESto"true". ๐
okay that's part 1, bestie โ more parts incoming, so stay tuned ๐ฆโจ
๐ฑ ENVIRONMENT ๐ฑ
okay bestie, opam reads a TON of environment variables and you're gonna want to know them, so buckle up. ๐
Quick rules for the boolean ones: to turn them off, set them to "0", "no", "false", or just the empty string. To turn them on, set "1", "yes", or "true". that's it, that's the whole system, periodt. โจ
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-effortoption is set, and is 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 to always or never, 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 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. 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-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$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.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/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, 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-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.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 of one of always, never or auto)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 of one of always, never or auto). 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. ๐ช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. ๐ซ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 literally every script and programmatic invocation of opam should be using --cli, no cap. Why? Because it keeps your stuff working seamlessly with future versions of the opam client. โจ And bonus: blog posts and other documentation lowkey benefit too, because it stops the info from going stale. ๐
Even though opam only supports roots (~/.opam/) for the current version, it does provide backwards compatibility for its command-line interface. iconic of it honestly. ๐
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 morethan once, where the last instance takes precedence. OPAMCLI is only inspected if --cli is not given.
bestie the way that last-instance-wins thing works is giving "last one to speak gets the mic" and honestly? correct. ๐ค
๐ EXIT STATUS ๐
Okay bestie, this is the part where opam tells you why it left. Every command exits with a number, and each number is a little mood ring for what just happened. ๐
โ ๏ธ One exception, and it's a big one: theexeccommand doesn't play by these rules at all. It returns127if the command wasn't found or couldn't be executed, and the command's own exit value otherwise. That's it. That's the whole tea. ๐ซ
Now for the regular lineup:
0โ Slay. Success, ortruefor boolean queries. โจ1โ False. This one shows up when a boolean return value is expected โ like when you're running with--check, or for queries likeopam lint. Not a crash, just a "no, girl." ๐2โ Bad command-line arguments, or arguments pointing at an invalid context (say, a file that doesn't follow the expected format). You gave it nonsense, it said no. ๐ญ5โ Not found. You asked for something (a package, a version, a repository, etc.) and it simply was not there. Gone. Missing. ๐10โ Aborted. The operation needed confirmation and you didn't give it. The vibe check failed. ๐ซ15โ Could not acquire the locks required for the operation. Something else was already holding the door. ๐20โ There is no solution to the user request. Classic cause: asking to install two incompatible packages. The math said no. โ30โ Error in package definition, or other metadata files. And heads up: using--strictraises this error more often. ๐31โ Package script error. Some package operations were unsuccessful. Might be an error in the packages, might be an incompatibility with your system. And note: 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 system configuration doesn't allow the operation, and it needs fixing before you can move on. ๐ง60โ Solver failure. The solver failed to return a sound answer. Could be a broken external solver, or an error in solver configuration. ๐งฎ99โ Internal error. Something went wrong, and it's most likely a bug in opam itself. Not you, bestie โ it's them. ๐130โ User interrupt.SIGINTwas received, generally because the user pressed Ctrl+C. You did this. We both know you did this. ๐
And then there's this lil secondary squad, which goes like:
0on success.123on indiscriminate errors reported on standard error.124on command line parsing errors.125on unexpected internal errors (bugs).
๐ FURTHER DOCUMENTATION ๐
The full lore lives at <https://opam.ocaml.org/doc>. Go read it. It's giving encyclopedia but make it OCaml. ๐ฆ
๐ AUTHORS ๐
These are the icons who built this. Respect the roster, fr fr:
- 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)โ go check out the main character, iykyk. ๐
๐ BUGS ๐
Found something cursed? Check bug reports at <https://github.com/ocaml/opam/issues>. Tell them everything, they want to know. ๐ธ
And that's a wrap on part 3, babe! ๐ This whole page is courtesy of Opam admin 2.6.1, filed under OPAM ADMIN-INDEX(1) โ that's the version and the section it lives in, so now you know exactly what you're reading. Go forth and admin index with confidence. You ate. Periodt. ๐โจ
๐ฆ 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