OPAM-SEARCH(1)
π NAME π
opam-search β bestie, it's literally just an alias for list --search. that's the whole thing. π
π SYNOPSIS π
opam search [--check] [--no-depexts] [--silent] [OPTION]β¦ [PATTERNS]β¦
π¦ DESCRIPTION π¦
okay so opam search is just a cute little alias for opam list --search. no cap, same energy, same behaviour. π
want the real tea? run opam list --help. all the details live over there. π«Ά
π PACKAGE SELECTION OPTIONS π
narrowing down which packages show up. pick your filter, pick your vibe:
--coinstallable-with=PACKAGESβ only list packages that are compatible with all ofPACKAGES. everyone in the group chat has to get along, fr.--conflicts-with=PACKAGESβ list packages that have declared conflicts with at least one of the packages you gave. and it's not just direct beef β this includes conflicts defined from the packages in the list, from the other package, or by a commonconflict-class:field. messy. π--depends-on=PACKAGESβ list only the packages that depend on one of the (comma-separated)PACKAGES.--depoptsβ include optional dependencies in dependency requests.--devβ include development packages in dependencies.--field-match=FIELD:PATTERNβ filter packages that have a match forPATTERNon the givenFIELD.--has-flag=FLAGβ only include packages that have the given flag set. package flags are one of:light-uninstallverboseplugincompilerconf.--has-tag=TAGβ only includes packages that have the given tag set.--no-switchβ list what's available from the repositories, without consideration for the current (or any other) switch. no installed or pinned packages, none of that. just the repos, raw. β¨--nobuildβ exclude build dependencies (they're included by default, fyi).--orβ instead of selecting packages that match all the criteria, select packages that match any of them. choose-your-own-adventure mode.--owns-file=FILEβ finds the installed packages responsible for installing the givenFILE. detective mode. π--postβ include dependencies tagged aspost.--recursiveβ with--depends-onand--required-by, display all transitive dependencies rather than just the direct ones. the whole tree, not just the branches you can see.--repos=REPOSβ include only packages that took their origin from one of the given repositories. heads up: unlessno-switchis also specified, this excludes pinned packages.--required-by=PACKAGESβ list only the dependencies of the (comma-separated)PACKAGES.--resolve=PACKAGESβ restrict to a solution to install the (comma-separated)PACKAGES, i.e. a consistent set of packages including those. and ngl this is subtly different from--required-by --recursive, which is more predictable and can't fail, but lists all dependencies independently without ensuring consistency. without--installed, the answer is self-contained and independent of the current installation. with--installed, it's computed from the set of currently installed packages.--no-switchfurther makes the solution independent from the currently pinned packages, architecture, and compiler version. oh and β the combination with--depoptsis not supported. π-t,--with-test,--testβ include test-only dependencies.--with-dev-setupβ include developer only dependencies.--with-doc,--docβ include doc-only dependencies.
π OUTPUT FORMAT OPTIONS π
this is the aesthetic section. how do you want it to look? π
--columns=COLUMNSβ select the columns to display, from these:name,version,package,synopsis,synopsis-or-target,description,<field>:,installed-version,pin,source-hash,opam-file,all-installed-versions,available-versions,all-versions,repository,installed-files,vc-ref,depexts. the special form<field>:(a field name followed by a colon, e.g.,license:) selects an arbitrary field. default isnamewhen--shortis present, andname,installed-version,synopsis-or-targetotherwise.-e,--external,--depextsβ instead of displaying the packages, display their external dependencies that are associated with the current system. this excludes other display options. and honestly? rather than using this directly, you should probably head for thedepextplugin, which will use your system package management system to handle the installation of the dependencies. runopam depext. π--normaliseβ print the values of opam fields normalised.-S,--sortβ sort the packages in dependency order (i.e. an order in which they could be individually installed). topologically slaying. β¨-s,--shortβ don't print a header, and sets the default columns tonameonly. if you need package versions included, use--columns=packageinstead.--separator=STRING (absent= )β set the column-separator string. yes, the default is a literal space.-V,--all-versionsβ normally, when multiple versions of a package match, only one is shown in the output (the installed one, the pinned-to one, or, failing that, the highest one available or the highest one). this flag disables that behaviour and shows all matching versions. it also changes the default display format to include package versions instead of just package names (including when--shortis set). and it's automatically turned on when a single non-pattern package name is provided on the command-line. π«--vars=[VAR=STR,...]β define the given variable bindings. typically useful with--externalto override the values forarch,os,os-distribution,os-version,os-family.--wrapβ wrap long lines. the default is to truncate when displaying on a terminal, or to keep as is otherwise.
π§ ORDER-SENSIBLE SELECTORS π§
these ones care about where a package sits in the order of things:
-a,--availableβ list only packages that are available on the current system.-A,--allβ include all, even uninstalled or unavailable packages. no filter, no judgement. π--baseβ removed in 2.1, use--invariantinstead.-i,--installedβ list installed packages only. this is the default when no further arguments are supplied.--installableβ list only packages that can be installed on the current switch. π careful though: this calls the solver and may be more costly. also a package depending on an unavailable package may be available, but is never installable.--invariantβ list only the immutable base of the current switch (i.e. invariant packages).--latests-onlyβ list only the latest version of each package.--pinnedβ list only the pinned packages.--roots,--installed-rootsβ list only packages that were explicitly installed, excluding the ones installed as dependencies. the main characters only. π
π ARGUMENTS π
PATTERNSβ package patterns with globs. unless--searchis specified, they match against aNAMEorNAME.VERSION.
π OPTIONS π
the last little trio, bestie:
--checkβ don't write anything in the output. exit with return code0if the list is not empty,1otherwise.--no-depextsβ disable external dependencies handling for the query. this can be used to include packages that are marked as unavailable because of an unavailable system dependency.--silentβ removed in 2.1, use--checkinstead.
β¨ COMMON OPTIONS β¨
Okay bestie, these options are literally common to all commands. Like, every single one. No cap. π
--best-effortβ okay so if you can't install every single package you asked for, this says "don't be dramatic, just install as many as you can". πͺ But heads up: not every external solver is gonna support this (recent versions ofaspcudormccsshould, though). It's the same as setting the$OPAMBESTEFFORTenvironment variable. fr fr.--cli=MAJOR.MINOR(absent=2.6) β this lets you use the command-line interface syntax and semantics ofMAJOR.MINOR. It's for when you're doing persistent opam stuff (scripts, blog posts, whatever), so any opam in the sameMAJORseries will act like theMINORrelease you picked. π But note: this flag didn't exist in opam 2.0, so if you want the 2.0 CLI, you gotta set theOPAMCLIenvironment variable to2.0instead. iykyk.--color=WHENβ turns on the colors, bestie. πWHENhas to be one ofalways,never, orauto. Periodt.--confirm-level=LEVELβ sets the confirmation level.LEVELmust be one ofask,no,yes, orunsafe-yes. You can specify this more than once. If--yesor--noare also given, then the value of the last--confirm-levelwins. It's equivalent to setting the$OPAMCONFIRMLEVELenvironment variable. π--criteria=CRITERIAβ lets you set your user preferences for dependency solving for this run. It overrides$OPAMCRITERIA,$OPAMFIXUPCRITERIA, and$OPAMUPGRADECRITERIA. For details on the supported language and the external solvers available, check outhttp://opam.ocaml.org/doc/External_solvers.html. And for a general guide to using solver preferences, peephttp://www.dicosmo.org/Articles/usercriteria.pdf. π--cudf=FILENAMEβ debug option, bestie. It 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. π--debugβ prints debug messages to stderr. It's the same as setting$OPAMDEBUGto"true". π--debug-level=LEVELβ like--debug, but you can pick the debug level (--debugjust sets it to1). Equivalent to setting$OPAMDEBUGto a positive integer. π--git-versionβ prints the git version of opam (if it's set, meaning you're using a development version) and then exits. π--help[=FMT](default=auto) β shows this help in formatFMT.FMTmust be one ofauto,pager,groff, orplain. Withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. πββοΈ--ignore-pin-dependsβ ignores extra pins required by packages that get pinned, whether manually throughopam pinor throughopam install DIR. This is equivalent to settingIGNOREPINDEPENDS=true. π--json=FILENAMEβ saves the results of the opam run in 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β 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. π--no-auto-upgradeβ when opam configures or updates a repository written for an earlier opam version (1.2), it internally converts it to the current format. This disables that behavior. Note: repositories should define their format version in a'repo'file at their root, or they'll be assumed to be in the older format. In any case, it's 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 behavior. π-q,--quietβ disables--verbose. π€«--root=ROOTβ usesROOTas the current root path. Equivalent to setting$OPAMROOTtoROOT. π³--safe,--readonlyβ makes 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$OPAMSAFEenvironment variable. π‘οΈ--solver=CMDβ specifies 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β fails whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible. π₯--switch=SWITCHβ usesSWITCHas the current compiler switch. Equivalent to setting$OPAMSWITCHtoSWITCH. π--use-internal-solverβ disables any external solver and uses the built-in one (this requires that opam was compiled with a built-in solver). 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,patch, etc.). 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. 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β answers yes to all opam yes/no questions without prompting. See also--confirm-level. Equivalent to setting$OPAMYESto"true". β
π ENVIRONMENT π
ok so bestie, opam is deeply into environment variables π like it will read these before you even finish typing, so listen up. Every one of these is listed below.
Quick rule for the boolean girlies: set them to "0", "no", "false" or the empty string to disable them, and "1", "yes" or "true" to enable them. That's it, that's the whole grammar π
OPAMALLPARENSβ surround all filters with parenthesis.OPAMASSUMEDEPEXTSβ see option--assume-depexts.OPAMAUTOANSWERβ internal use only π (not for you, babe).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. π gone, deceased, rip.OPAMBUILDTESTβ Removed in 2.1. also dead π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, so runconfig 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--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-dironupdate. 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. slay, it truly said "I'm the main character here" π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/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, 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-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. π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 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 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-on.OPAMVERSIONLAGPOWERβ do not use. π that's it, that's the whole instruction, 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 π°οΈ
ok so this one is the "future-proof yourself" section and honestly it's giving responsibly slay β¨
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 β and this is the cute part β blog posts or other documentation can benefit, as it prevents information from becoming stale. no more dusty tutorials, bestie π
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.
π EXIT STATUS
Okay bestie, listen β opam tells you exactly why it's mad at you, in numbers. Here's the decoder ring π
π One big exception to everything below: theexeccommand returns127if the command wasn't found or couldn't be executed, and otherwise it returns the command's own exit value. So like,opam exechands you the vibes of the thing it ran. iykyk.
0β Success! Or "true" for boolean queries. We love a green flag π1β False. This one shows up when a boolean return value is expected, like when you run with--check, or for queries likeopam lint.2β Bad command-line arguments, or arguments that point at an invalid context (e.g. a file that isn't in the expected format). Basically: bestie, that's not a thing.5β Not found. You asked for something (package, version, repository, etc.) and it simply does not exist. Ghosted, fr fr π»10β Aborted. The operation needed confirmation and you didn't give it. No consent, no command π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. Classic cause: asking to install two incompatible packages at once. Pick a lane, babe β30β Error in package definition, or in other metadata files. 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. This 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 config doesn't allow the operation, and it needs fixing.60β Solver failure. The solver failed to return a sound answer. Could be a broken external solver, or an error in the solver configuration. The solver is going through it π«99β Internal error. Something went wrong, likely due to a bug in opam itself. Not your fault, bestie.130β User interrupt.SIGINTwas received, generally because the user pressed Ctrl+C. You did this. It's fine. We've all done it π
And then there's this lil' cluster, exactly as listed:
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. Go read it, it's giving β¨ scholarly β¨.
π AUTHORS
The absolute icons who built this. 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(1)β the main character. Go read that one too.
π BUGS
Check bug reports at https://github.com/ocaml/opam/issues. Found a bug? Report it, don't just suffer in silence, bestie π«Ά
And that's the whole page, babes!! π This was Opam 2.6.1, served up as OPAM-SEARCH(1), and we are officially done. Now go search for some packages and 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