opam manpage (original) (raw)
NAME
opam - source-based package management
SYNOPSIS
opam[_COMMAND_] â¦
DESCRIPTION
Opam is a package manager. It uses the powerful mancoosi tools to handle dependencies, including support for version constraints, optional dependencies, and conflict management. The default configuration binds it to the official package repository for OCaml.
It has support for different remote repositories such as HTTP, rsync, git, darcs and mercurial. Everything is installed within a local opam directory, that can include multiple installation prefixes with different sets of installed packages.
Use eitheropam --help or opam help for more information on a specific command.
COMMANDS
admin[_OPTION_]â¦
Tools for repository administrators
clean[_OPTION_]â¦
Cleans up opam caches
config[_OPTION_]⦠[_COMMAND_] [_ARG_]â¦
Display configuration options for packages.
env[_OPTION_]â¦
Prints appropriate shell variable assignments to stdout
exec[_OPTION_]⦠_COMMAND [ARG]..._â¦
Executes a command in the proper opam environment
help[--man-format=_FMT_] [_OPTION_]⦠[_TOPIC_]
Display help about opam and opam commands.
init[_OPTION_]⦠[_NAME_] [_ADDRESS_]
Initialize opam state, or set init options.
install[_OPTION_]⦠[_PACKAGES_]â¦
Install a list of packages.
lint[_OPTION_]⦠[_FILES_]â¦
Checks and validate package description ('opam') files.
list [--check] [--no-depexts] [--silent] [_OPTION_]⦠[_PATTERNS_]â¦
Display the list of available packages.
lock[--direct-only] [--keep-local] [--lock-suffix=_SUFFIX_] [_OPTION_]â¦
[_PACKAGES_]â¦
Create locked opam files to share build environments across hosts.
option [--global] [_OPTION_]⦠[_FIELD[(=|+=|-=)[VALUE]]_]
Global and switch configuration options settings
pin[_OPTION_]⦠[_COMMAND_] [_ARG_]â¦
Pin a given package to a specific version or source.
reinstall[_OPTION_]⦠[_PACKAGES_]â¦
Reinstall a list of packages.
remove[_OPTION_]⦠[_PACKAGES_]â¦
Remove a list of packages.
repository[--kind=_KIND_] [--rank=_RANK_] [--short] [_OPTION_]⦠[_COMMAND_]
[_ARG_]â¦
Manage opam repositories.
show[_OPTION_]⦠[_PACKAGES_]â¦
Display information about specific packages.
source[_OPTION_]⦠PACKAGE
Get the source of an opam package.
switch[_OPTION_]⦠[_COMMAND_] [_ARG_]â¦
Manage multiple installation prefixes.
tree [--recursive] [--subpath=_PATH_] [_OPTION_]⦠[_PACKAGES_]â¦
Draw the dependency forest of installed packages.
update[_OPTION_]⦠[_NAMES_]â¦
Update the list of available packages.
upgrade[_OPTION_]⦠[_PACKAGES_]â¦
Upgrade the installed package to latest version.
var [--global] [--package=_PACKAGE_] [_OPTION_]⦠[_VAR[=[VALUE]]_]
Display and update the value associated with a given variable
COMMAND ALIASES
info[_OPTION_]⦠[_PACKAGES_]â¦
An alias for show.
remote[--kind=_KIND_] [--rank=_RANK_] [--short] [_OPTION_]⦠[_COMMAND_]
[_ARG_]â¦
An alias forrepository.
search [--check] [--no-depexts] [--silent] [_OPTION_]⦠[_PATTERNS_]â¦
An alias for list --search.
uninstall[_OPTION_]⦠[_PACKAGES_]â¦
An alias for remove.
unpin[_OPTION_]⦠[_ARG_]â¦
An alias for pin remove.
why [--recursive] [--subpath=_PATH_] [_OPTION_]⦠[_PACKAGES_]â¦
An alias for tree --rev-deps.
COMMON OPTIONS
These options are common to all commands.
--best-effort
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.
--cli=MAJOR.MINOR(absent=2.4)
Use the command-line interface syntax and semantics of MAJOR.MINOR. Intended for any persistent use of opam (scripts, blog posts, etc.), any version of opam in the same MAJOR series will behave as for the specified MINOR release. The flag was not available in opam 2.0, so to select the 2.0 CLI, set the OPAMCLIenvironment variable to 2.0 instead of using this parameter.
--color=WHEN
Colorize the output.WHEN must be one of always, never orauto.
--confirm-level=LEVEL
Confirmation level,LEVEL must be one of ask, no,yes or unsafe-yes. Can be specified more than once. If --yes or --no are also given, the value of the last --confirm-level is taken into account. This is equivalent to setting**$OPAMCONFIRMLEVEL**‘.
--criteria=CRITERIA
Specify user preferences_for dependency solving for this run. Overrides**$OPAMCRITERIA**, $OPAMFIXUPCRITERIA 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_.
--cudf=FILENAME
Debug option: Save the CUDF requests sent to the solver to_FILENAME_-.cudf where is the n-th call to the solver during the opam run.
--debug
Print debug message to stderr. This is equivalent to setting $OPAMDEBUG to "true".
--debug-level=LEVEL
Like --debug, but allows specifying the debug level (--debug sets it to 1). Equivalent to setting $OPAMDEBUG to 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 format_FMT_. The value FMT must be one of auto,pager, groff or plain. Withauto, the format is pager or plainwhenever the TERM env var is dumb or undefined.
--ignore-pin-depends
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.
--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 $OPAMJSON variable.
--no
Answer no to all opam yes/no questions without prompting. See also--confirm-level. This is equivalent to setting**$OPAMNO** to "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 using opam admin upgrade [--mirror URL] when possible.
--no-self-upgrade
Opam will replace itself with a newer binary found at OPAMROOT/opam if present. This disables this behaviour.
-q, --quiet
Disables --verbose.
--root=ROOT
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 $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 supports builtin-dummy-solver, 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
Use SWITCH as the current compiler switch. This is equivalent to setting**$OPAMSWITCH** to SWITCH.
--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 $OPAMNOASPCUD or**$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 $OPAMVERBOSE to "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**$OPAMYES** to "true".
ENVIRONMENT
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.
_OPAMASSUMEDEPEXTS_see option ‘--assume-depexts'.
_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.
_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 ‘--color' option.
_OPAMCONFIRMLEVEL_see option ‘--confirm-level‘.OPAMCONFIRMLEVEL has priority over OPAMYES andOPAMNO.
_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_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. 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'.
_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$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.
_OPAMFIXUPCRITERIA_same as OPAMUPGRADECRITERIA, but specific to fixup and reinstall.
_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 ‘--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.
_OPAMMERGEOUT_merge process outputs, stderr on stdout.
_OPAMNO_answer no to any question asked, see options ‘--no‘ and ‘--confirm-level‘.OPAMNO is ignored if either OPAMCONFIRMLEVELor OPAMYES is set.
_OPAMNOAGGREGATE_with ‘opam 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-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 the repositories as tar.gz files. This can be much faster on filesystems that don't cope well with scanning large trees but have good caching in /tmp. However this is slower in the general case.
_OPAMREQUIRECHECKSUMS_Enables option ‘--require-checksums' when available (e.g. for ‘opam install').
_OPAMRETRIES_sets the number of tries before failing downloads.
_OPAMREUSEBUILDDIR_see option ‘--reuse-build-dir'.
_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.
OPAMSOLVERALLOWSUBOPTIMAL(default ‘true') 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. If ‘true', opam willcontinue with a warning, if ‘false' a timeout is an error. Currently only the builtin-z3 backend handles this degraded case.
_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.
_OPAMSOLVERTOLERANCE_changes the tolerance towards the solver choosing an unoptimized solution (i.e. might pull outdated packages). Typical values range from 0.0 (best solution known to the solver) to 1.0 (unoptimized solution). Default is 0.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 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_Removed in 2.2.
_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 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.
_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 ‘--yes' and ‘--confirm-level‘.OPAMYES has priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
_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.
CLI VERSION
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. Additionally, blog posts or other documentation can benefit, as 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 morethan once, where the last instance takes precedence. OPAMCLI is only inspected if ‘--cli' is not given.
EXIT STATUS
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.
0 | Success, or true for boolean queries. |
---|---|
1 | False. Returned when a boolean return value is expected, e.g. when running with --check, or for queries likeopam lint. |
2 | Bad command-line arguments, or command-line arguments pointing to an invalid context (e.g. file not following the expected format). |
5 | Not found. You requested something (package, version, repository, etc.) that couldn't be found. |
10 | Aborted. The operation required confirmation, which wasn't given. |
15 | Could not acquire the locks required for the operation. |
20 | There is no solution to the user request. This can be caused by asking to install two incompatible packages, for example. |
30 | Error in package definition, or other metadata files. Using --strict raises 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. This can be a partial error. |
40 | Sync error. Could not fetch some remotes from the network. This can be a partial error. |
50 | Configuration error. Opam or system configuration doesn't allow operation, and needs fixing. |
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. |
99 | Internal error. Something went wrong, likely due to a bug in opam itself. |
130 | User interrupt. SIGINT was received, generally due to the user pressing Ctrl-C. |
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.
AUTHORS
David Allsopp david@tarides.com
Vincent Bernardoff vb@luminar.eu.org
Raja Boujbel raja.boujbel@ocamlpro.com
Kate Deplaix kit-ty-kate@outlook.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
BUGS
Check bug reports at https://github.com/ocaml/opam/issues.