opam-reinstall man page

opam-reinstall ā€” Reinstall a list of packages.


opam reinstall [OPTION]... [PACKAGES]...


This command removes the given packages and the ones that depend on them, and reinstalls the same versions. Without arguments, assume --pending and reinstall any package with upstream changes.

If a directory is specified as argument, anything that is pinned to that directory is selected for reinstall.



List of package names, with an optional version or constraint, e.g `pkg', `pkg.1.0' or `pkg>=0.5' ; or directory names containing package description, with explicit directory (e.g. `./srcdir' or `.')



Forget about pending reinstallations of listed packages. This implies making opam assume that your packages were installed with a newer version of their metadata, so only use this if you know what you are doing, and the actual changes you are overriding.

-j JOBS, --jobs=JOBS

Set the maximal number of concurrent jobs to use. You can also set it using the $OPAMJOBS environment variable.


List packages that have been changed since installed and are marked for reinstallation


Perform pending reinstallations, i.e. reinstallations of packages that have changed since installed

Package Build Options

-b, --keep-build-dir

Keep the build directories after compiling packages. This is equivalent to setting $OPAMKEEPBUILDDIR to "true".

-d, --with-doc, --build-doc

Build the package documentation. This only affects packages listed on the command-line. The --build-doc form is deprecated as this does also installation. This is equivalent to setting $OPAMWITHDOC (or the deprecated $OPAMBUILDDOC) to "true".


Simulate the command, but don't actually perform any changes.


This option registers the actions into the opam database, without actually performing them. WARNING: This option is dangerous and likely to break your opam environment. You probably want `--dry-run'. You've been warned.

--ignore-constraints-on[=PACKAGES] (default=)

Forces opam to ignore version constraints on all dependencies to the listed packages. This can be used to test compatibility, but expect builds to break when using this. Note that version constraints on optional dependencies and conflicts are unaffected.


When compiling a package which has its source bound to a local directory, process the build and install actions directly in that directory, rather than in a clean copy handled by opam. This only affects packages that are explicitely listed on the command-line. This is equivalent to setting $OPAMINPLACEBUILD to "true".

-m MAKE, --make=MAKE

Use MAKE as the default 'make' command. Deprecated: use opam config set[-global] make MAKE instead. Has no effect if the make variable is defined.


Do not verify the checksum of downloaded archives.This is equivalent to setting $OPAMNOCHECKSUMS to "true".


Reject the installation of packages that don't provide a checksum for the upstream archives. This is equivalent to setting $OPAMREQUIRECHECKSUMS to "true".


Reuse existing build directories (kept by using --keep-build-dir), instead of compiling from a fresh clone of the source. This can be faster, but also lead to failures if the build systems of the packages don't handle upgrades of dependencies well. This is equivalent to setting $OPAMREUSEBUILDDIR to "true".


Call the solver and display the actions. Don't perform any changes.


When running an install, upgrade or reinstall on source-pinned packages, they are normally updated from their origin first. This flag disables that behaviour and will keep them to their version in cache.

-t, --with-test, --build-test

Build and run the package unit-tests. This only affects packages listed on the command-line. The --build-test form is deprecated as this also affects installation. This is equivalent to setting $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true".


Allow changes to the packages set as switch base (typically, the main compiler). Use with caution.

Common Options

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).


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/Specifying_Solver_Preferences.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 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.


Specify the CUDF solver to use for resolving package installation problems. This is either a predefined solver (this version of opam supports builtin-mccs+glpk, aspcud, mccs, aspcud-old, packup), or a custom command that should contain the variables %{input}%, %{output}%, %{criteria}%, and optionally %{timeout}%.


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.

--use-internal-solver, --no-aspcud

Disable any external solver, and use the built-in one (this requires that opam has been compiled with a built-in solver).

-v, --verbose

Be more verbose, show package sub-commands and their output. Repeat to see more. 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 commited state, or the ref they are pointing to. This only affects packages explicitely listed on the command-line.

-y, --yes

Answer yes to all yes/no questions without prompting. This is equivalent to setting $OPAMYES to "true".

Environment Variables

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.

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

OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH for more options.

OPAMDEBUG see options `--debug' and `--debug-level'.

OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.

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

OPAMEXTERNALSOLVER see option `--solver'.

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.

OPAMJOBS sets the maximum number of parallel workers to run.

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

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.

OPAMNO answer no to any question asked.

OPAMNOASPCUD see option `--no-aspcud'.

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.

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

OPAMRETRY sets the number of tries before failing downloads.

OPAMROOT see option `--root'. This is automatically set by `opam env --root=DIR' when DIR is non-default or OPAMROOT is already defined.

OPAMROOTISOK don't complain when running as root.

OPAMSAFE see option `--safe'

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')

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

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'.

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.

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'.

OPAMYES see option `--yes'.

Exit Status


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.

Further Documentation

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


Thomas Gazagnaire <thomas@gazagnaire.org>

Anil Madhavapeddy <anil@recoil.org>

Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>

Frederic Tuong <tuong@users.gforge.inria.fr>

Louis Gesbert <louis.gesbert@ocamlpro.com>

Vincent Bernardoff <vb@luminar.eu.org>

Guillem Rieu <guillem.rieu@ocamlpro.com>

Roberto Di Cosmo <roberto@dicosmo.org>


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


Opam 2.0.0~beta6 Opam Manual