Section: Opam Manual (1)
Index Return to Main Contents


opam-list - Display the list of available packages.  


opam list [OPTION]... [PATTERNS]...  


List selections of opam packages.

Without argument, the command displays the list of currently installed packages. With pattern arguments, lists all available packages matching one of the patterns.

Unless the --short switch is used, the output format displays one package per line, and each line contains the name of the package, the installed version or `--' if the package is not installed, and a short description. In color mode, manually installed packages (as opposed to automatically installed ones because of dependencies) are underlined.

See section PACKAGE SELECTION OPTIONS for all the ways to select the packages to be displayed, and section OUTPUT FORMAT OPTIONS to customise the output format.

For a more detailed description of packages, see opam show. For extended search capabilities within the packages' metadata, see opam search.  


Package patterns with globs. Unless --search is specified, they match againsta NAME or NAME.VERSION


-A, --all
Include all, even uninstalled or unavailable packages
-a, --available
List only packages that are available on the current system
List only the immutable base of the current switch (i.e. compiler packages)
Only list packages that are compatible with all of PACKAGES.
List packages that have declared conflicts with at least one of the given list. This includes conflicts defined from the packages in the list, from the other package, or by a common conflict-class: field.
List only packages that depend on one of (comma-separated) PACKAGES.
Include optional dependencies in dependency requests.
Include development packages in dependencies.
Filter packages with a match for PATTERN on the given FIELD
Only include packages which have the given flag set. Package flags are one of: light-uninstall verbose plugin compiler conf
Only includes packages which have the given tag set
-i, --installed
List installed packages only. This is the default when no further arguments are supplied
List only packages that can be installed on the current switch (this calls the solver and may be more costly; a package depending on an unavailable package may be available, but is never installable)
List what is available from the repositories, without consideration for the current (or any other) switch (installed or pinned packages, etc.)
Exclude build dependencies (they are included by default).
Instead of selecting packages that match all the criteria, select packages that match any of them
Finds installed packages responsible for installing the given file
List only the pinned packages
Include dependencies tagged as post.
With `--depends-on' and `--required-by', display all transitive dependencies rather than just direct dependencies.
Include only packages that took their origin from one of the given repositories (unless no-switch is also specified, this excludes pinned packages).
List only the dependencies of (comma-separated) PACKAGES.
Restrict to a solution to install (comma-separated) PACKAGES, i.e. a consistent set of packages including those. 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-switch` further makes the solution independent from the currently pinned packages, architecture, and compiler version. The combination with `--depopts' is not supported.
--roots, --installed-roots
List only packages that were explicitly installed, excluding the ones installed as dependencies
Match PATTERNS against the full descriptions of packages, and require all of them to match, instead of requiring at least one to match against package names (unless --or is also specified).
-t, --with-test, --test
Include test-only dependencies.
--with-doc, --doc
Include doc-only dependencies.


Select the columns to display among: name, version, package, synopsis, synopsis-or-target, description, <field>, <field>:, installed-version, pin, source-hash, opam-file, all-installed-versions, available-versions, all-versions, repository, installed-files, vc-ref, depexts. The default is name when --short is present and name, installed-version, synopsis-or-target otherwise.
-e, --external, --depexts
Instead of displaying the packages, display their external dependencies that are associated with the current system. This excludes other display options. Rather than using this directly, you should probably head for the `depext' plugin, that will use your system package management system to handle the installation of the dependencies. Run `opam depext'.
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.)
-s, --short
Don't print a header, and sets the default columns to name only. If you need package versions included, use --columns=package instead
--separator=STRING (absent= )
Set the column-separator string
-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 this behaviour and shows all matching versions. This also changes the default display format to include package versions instead of just package names (including when --short is set). This is automatically turned on when a single non-pattern package name is provided on the command-line.
Define the given variable bindings. Typically useful with --external to override the values for arch, os, os-distribution, os-version, os-family.
Wrap long lines, the default being to truncate when displaying on a terminal, or to keep as is otherwise


Don't write anything in the output, exit with return code 0 if the list is not empty, 1 otherwise.


These options are common to all commands.

Don't fail if all requested packages can't be installed: try to install as many as possible. Note that not all external solvers may support this option (recent versions of aspcud or mccs should). This is equivalent to setting $OPAMBESTEFFORT environment variable.
Colorize the output. WHEN must be one of `always', `never' or `auto'.
Specify user preferences for dependency solving for this run. Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details on the supported language, and the external solvers available, see http://opam.ocaml.org/doc/External_solvers.html. A general guide to using solver preferences can be found at http://www.dicosmo.org/Articles/usercriteria.pdf.
Debug option: Save the CUDF requests sent to the solver to FILENAME-<n>.cudf.
Print debug message to stderr. This is equivalent to setting $OPAMDEBUG to "true".
Like --debug, but allows specifying the debug level (--debug sets it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
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 format FMT. The value FMT must be one of `auto', `pager', `groff' or `plain'. With `auto', the format is `pager` or `plain' whenever the TERM env var is `dumb' or undefined.
Ignore extra pins required by packages that get pinned, either manually through opam pin or through opam install DIR. This is equivalent to setting IGNOREPINDEPENDS=true.
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 $OPAMJSON variable.
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 using opam admin upgrade [--mirror URL] when possible.
Opam will replace itself with a newer binary found at $(b,OPAMROOT/opam) if present. This disables this behaviour.
-q, --quiet
Disables --verbose.
Use ROOT as the current root path. This is equivalent to setting $OPAMROOT to ROOT.
--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 $OPAMDEBUG variable. This is equivalent to set environment variable $OPAMSAFE.
Specify the CUDF solver to use for resolving package installation problems. This is either a predefined solver (this version of opam supports builtin-mccs+lp(), builtin-mccs+glpk, builtin-dummy-z3-solver, 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.
Fail whenever an error is found in a package definition or a configuration file. The default is to continue silently if possible.
Use SWITCH as the current compiler switch. This is equivalent to setting $OPAMSWITCH to SWITCH.
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 $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
-v, --verbose
Be more verbose. One -v shows all package commands, repeat to also display commands called internally (e.g. tar, curl, patch etc.) Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
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, it 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 yes/no questions without prompting. This is equivalent to setting $OPAMYES to "true".


Opam makes use of the environment variables listed here. Boolean variables should be set to "0", "no", "false" or the empty string to disable, "1", "yes" or "true" to enable.

OPAMALLPARENS surround all filters with parenthesis

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 the `opam-query` property in the solution

OPAMCOLOR, when set to always or never, sets a default value for the --color option.

OPAMCRITERIA specifies user preferences for dependency solving. The default value depends on the solver version, use `config report` to know the current setting. See also option --criteria

OPAMCUDFFILE file save the cudf graph to file-actions-explicit.dot

OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH for 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:2 or CLIENT CUDF:2, but otherwise use `--debug-level'.

OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.

OPAMDRYRUN see option `--dry-run`

OPAMEDITOR sets the editor to use for opam file editing, overrides $EDITOR and $VISUAL

OPAMERRLOGLEN sets the number of log lines printed when a sub-process fails. 0 to print all.

OPAMEXTERNALSOLVER see option `--solver'.

OPAMFAKE see option `--fake`

OPAMFETCH specifies how to download files: either `wget', `curl' or a custom command where variables %{url}%, %{out}%, %{retry}%, %{compress}% and %{checksum}% will be replaced. Overrides the 'download-command' value from the main config file.


OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on`

OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends`

OPAMJOBS sets the maximum number of parallel workers to run.

OPAMJSON log json output to the given file (use character `%' to index the files)

OPAMLOCKED combination of `--locked` and `--lock-suffix` options

OPAMLOGS logdir sets log directory, default is a temporary directory in /tmp

OPAMMAKECMD set the system make command to use

OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories in an earlier format to the current one, on 'update' or 'init'.

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

OPAMLOCKRETRIES sets the number of tries after which opam gives up acquiring its lock and fails. <= 0 means infinite wait.

OPAMMERGEOUT merge process outputs, stderr on stdout

OPAMNO answer no to any question asked.


OPAMNOCHECKSUMS enables option --no-checksums when available.

OPAMDROPWORKINGDIR overrides packages previously updated with --working-dir on update. Without this variable set, opam would keep them unchanged unless explicitely named on the command-line.

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

OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when available (e.g. for `opam install`).

OPAMRETRIES sets the number of tries before failing downloads.

OPAMROOT see option `--root'. This is automatically set by `opam 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.

OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is 60.0, set to 0 for unlimited. Note that all solvers may not support this option.

OPAMSTATUSLINE display a dynamic status line showing what's currently going on on the terminal. (one of one of `always', `never' or `auto')

OPAMSTATS display stats at the end of command

OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.)

OPAMSWITCH see option `--switch'. Automatically set by `opam env --switch=SWITCH --set-switch'.

OPAMUNLOCKBASE see install option `--unlock-base`

OPAMUPGRADECRITERIA specifies user preferences for dependency solving when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both are set. See also option --criteria

OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.

OPAMUSEOPENSSL force openssl use for hash computing

OPAMUTF8 use UTF8 characters in output (one of one of `always', `never' or `auto'). By default `auto', which is determined from the locale).

OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages. Implies OPAMUTF8. This is set by default on OSX only.

OPAMVALIDATIONHOOK hook if set, uses the `%{hook%}` command to validate an opam repository update

OPAMVAR_var overrides the contents of the variable var when substituting `%{var}%` strings in `opam` files.

OPAMVAR_package_var overrides the contents of the variable package:var when substituting `%{package:var}%` strings in `opam` files.

OPAMVERBOSE see option `--verbose'.

OPAMWORKINGDIR see option `--working-dir`

OPAMYES see option `--yes'.  


As an exception to the following, the `exec' command returns 127 if the command was not found or couldn't be executed, and the command's exit value otherwise.

Success, or true for boolean queries.
False. Returned when a boolean return value is expected, e.g. when running with --check, or for queries like opam lint.
Bad command-line arguments, or command-line arguments pointing to an invalid context (e.g. file not following the expected format).
Not found. You requested something (package, version, repository, etc.) that couldn't be found.
Aborted. The operation required confirmation, which wasn't given.
Could not acquire the locks required for the operation.
There is no solution to the user request. This can be caused by asking to install two incompatible packages, for example.
Error in package definition, or other metadata files. Using --strict raises this error more often.
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.
Sync error. Could not fetch some remotes from the network. This can be a partial error.
Configuration error. Opam or system configuration doesn't allow operation, and needs fixing.
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.
Internal error. Something went wrong, likely due to a bug in opam itself.
User interrupt. SIGINT was received, generally due to the user pressing Ctrl-C.


See https://opam.ocaml.org/doc.  


Vincent Bernardoff <vb@luminar.eu.org>

Raja Boujbel <raja.boujbel@ocamlpro.com>

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>  


Check bug reports at https://github.com/ocaml/opam/issues.




This document was created by man2html, using the manual pages.
Time: 01:01:30 GMT, October 16, 2019