1opam-install(1) Opam Manual opam-install(1)
2
3
4
6 opam-install - Install a list of packages.
7
9 opam install [OPTION]... [PACKAGES]...
10
12 This command installs one or more packages inside the currently
13 selected switch (see opam switch). Once installed, you can remove
14 packages with opam remove, upgrade them with opam upgrade, and list
15 them with opam list. See opam pin as well to manage package versions,
16 reroute existing packages or add packages that are not defined in the
17 repositories.
18
19 All required dependencies of the selected packages will be installed
20 first. Any already installed packages having dependencies, or optional
21 dependencies to the changed packages will be recompiled. The proposed
22 solution may also imply removing incompatible or conflicting packages.
23
24 If paths are provided as argument instead of packages, they are assumed
25 to point to either project source directories containing one or more
26 package definitions (opam files), or directly to opam files. Then the
27 corresponding packages will be pinned to their local directory and
28 installed (unless --deps-only was specified).
29
31 PACKAGES
32 List of package names, with an optional version or constraint, e.g
33 `pkg', `pkg.1.0' or `pkg>=0.5' ; or files or directory names
34 containing package description, with explicit directory (e.g.
35 `./foo.opam' or `.')
36
38 --assume-built
39 For use on locally-pinned packages: assume they have already been
40 correctly built, and only run their installation instructions,
41 directly from their source directory. This skips the build
42 instructions and can be useful to install packages that are being
43 worked on. Implies --inplace-build. No locally-pinned packages will
44 be skipped.
45
46 --deps-only
47 Install all its dependencies, but don't actually install the
48 package.
49
50 --destdir=DIR
51 Copy the files installed by the given package within the current
52 opam switch below the prefix DIR, respecting their hierarchy, after
53 installation. Caution, calling this can overwrite, but never remove
54 files, even if they were installed by a previous use of --destdir,
55 e.g. on a previous version of the same package. See opam remove
56 --destdir to revert.
57
58 -j JOBS, --jobs=JOBS
59 Set the maximal number of concurrent jobs to use. The default value
60 is calculated from the number of cores. You can also set it using
61 the $OPAMJOBS environment variable.
62
63 --restore
64 Attempt to restore packages that were marked for installation but
65 have been removed due to errors
66
67 --set-root
68 Mark given packages as installed roots. This is the default for
69 newly manually-installed packages.
70
71 --unset-root
72 Mark given packages as "installed automatically".
73
75 -b, --keep-build-dir
76 Keep the build directories after compiling packages. This is
77 equivalent to setting $OPAMKEEPBUILDDIR to "true".
78
79 -d, --with-doc, --build-doc
80 Build the package documentation. This only affects packages listed
81 on the command-line. The --build-doc form is deprecated as this
82 does also installation. This is equivalent to setting $OPAMWITHDOC
83 (or the deprecated $OPAMBUILDDOC) to "true".
84
85 --dry-run
86 Simulate the command, but don't actually perform any changes.
87
88 --fake
89 This option registers the actions into the opam database, without
90 actually performing them. WARNING: This option is dangerous and
91 likely to break your opam environment. You probably want
92 `--dry-run'. You've been warned.
93
94 --ignore-constraints-on[=PACKAGES] (default=)
95 Forces opam to ignore version constraints on all dependencies to
96 the listed packages. This can be used to test compatibility, but
97 expect builds to break when using this. Note that version
98 constraints on optional dependencies and conflicts are unaffected.
99
100 --inplace-build
101 When compiling a package which has its source bound to a local
102 directory, process the build and install actions directly in that
103 directory, rather than in a clean copy handled by opam. This only
104 affects packages that are explicitly listed on the command-line.
105 This is equivalent to setting $OPAMINPLACEBUILD to "true".
106
107 --locked[=SUFFIX] (default=locked)
108 In commands that use opam files found from pinned sources, if a
109 variant of the file with an added .SUFFIX extension is found (e.g.
110 foo.opam.locked besides foo.opam), that will be used instead. This
111 is typically useful to offer a more specific set of dependencies
112 and reproduce similar build contexts, hence the name. The opam lock
113 plugin can be used to generate such files, based on the versions of
114 the dependencies currently installed on the host. This is
115 equivalent to setting the $OPAMLOCK environment variable. Note that
116 this option doesn't generally affect already pinned packages.
117
118 -m MAKE, --make=MAKE
119 Use MAKE as the default 'make' command. Deprecated: use opam config
120 set[-global] make MAKE instead. Has no effect if the make variable
121 is defined.
122
123 --no-checksums
124 Do not verify the checksum of downloaded archives.This is
125 equivalent to setting $OPAMNOCHECKSUMS to "true".
126
127 --require-checksums
128 Reject the installation of packages that don't provide a checksum
129 for the upstream archives. This is equivalent to setting
130 $OPAMREQUIRECHECKSUMS to "true".
131
132 --reuse-build-dir
133 Reuse existing build directories (kept by using --keep-build-dir),
134 instead of compiling from a fresh clone of the source. This can be
135 faster, but also lead to failures if the build systems of the
136 packages don't handle upgrades of dependencies well. This is
137 equivalent to setting $OPAMREUSEBUILDDIR to "true".
138
139 --show-actions
140 Call the solver and display the actions. Don't perform any changes.
141
142 --skip-updates
143 When running an install, upgrade or reinstall on source-pinned
144 packages, they are normally updated from their origin first. This
145 flag disables that behaviour and will keep them to their version in
146 cache.
147
148 -t, --with-test, --build-test
149 Build and run the package unit-tests. This only affects packages
150 listed on the command-line. The --build-test form is deprecated as
151 this also affects installation. This is equivalent to setting
152 $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true".
153
154 --unlock-base
155 Allow changes to the packages set as switch base (typically, the
156 main compiler). Use with caution.
157
159 These options are common to all commands.
160
161 --best-effort
162 Don't fail if all requested packages can't be installed: try to
163 install as many as possible. Note that not all external solvers may
164 support this option (recent versions of aspcud or mccs should).
165
166 --color=WHEN
167 Colorize the output. WHEN must be one of `always', `never' or
168 `auto'.
169
170 --criteria=CRITERIA
171 Specify user preferences for dependency solving for this run.
172 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
173 on the supported language, and the external solvers available, see
174 http://opam.ocaml.org/doc/Specifying_Solver_Preferences.html. A
175 general guide to using solver preferences can be found at
176 http://www.dicosmo.org/Articles/usercriteria.pdf.
177
178 --cudf=FILENAME
179 Debug option: Save the CUDF requests sent to the solver to
180 FILENAME-<n>.cudf.
181
182 --debug
183 Print debug message to stderr. This is equivalent to setting
184 $OPAMDEBUG to "true".
185
186 --debug-level=LEVEL
187 Like --debug, but allows specifying the debug level (--debug sets
188 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
189
190 --git-version
191 Print the git version of opam, if set (i.e. you are using a
192 development version), and exit.
193
194 --help[=FMT] (default=auto)
195 Show this help in format FMT. The value FMT must be one of `auto',
196 `pager', `groff' or `plain'. With `auto', the format is `pager` or
197 `plain' whenever the TERM env var is `dumb' or undefined.
198
199 --ignore-pin-depends
200 Ignore extra pins required by packages that get pinned, either
201 manually through opam pin or through opam install DIR. This is
202 equivalent to setting IGNOREPINDEPENDS=true.
203
204 --json=FILENAME
205 Save the results of the opam run in a computer-readable file. If
206 the filename contains the character `%', it will be replaced by an
207 index that doesn't overwrite an existing file. Similar to setting
208 the $OPAMJSON variable.
209
210 --no-auto-upgrade
211 When configuring or updating a repository that is written for an
212 earlier opam version (1.2), opam internally converts it to the
213 current format. This disables this behaviour. Note that
214 repositories should define their format version in a 'repo' file at
215 their root, or they will be assumed to be in the older format. It
216 is, in any case, preferable to upgrade the repositories manually
217 using opam admin upgrade [--mirror URL] when possible.
218
219 --no-self-upgrade
220 Opam will replace itself with a newer binary found at OPAMROOT/opam
221 if present. This disables this behaviour.
222
223 -q, --quiet
224 Disables --verbose.
225
226 --root=ROOT
227 Use ROOT as the current root path. This is equivalent to setting
228 $OPAMROOT to ROOT.
229
230 --safe, --readonly
231 Make sure nothing will be automatically updated or rewritten.
232 Useful for calling from completion scripts, for example. Will fail
233 whenever such an operation is needed ; also avoids waiting for
234 locks, skips interactive questions and overrides the $OPAMDEBUG
235 variable.
236
237 --solver=CMD
238 Specify the CUDF solver to use for resolving package installation
239 problems. This is either a predefined solver (this version of opam
240 supports builtin-mccs+lp(), builtin-mccs+glpk, aspcud, mccs,
241 aspcud-old, packup), or a custom command that should contain the
242 variables %{input}%, %{output}%, %{criteria}%, and optionally
243 %{timeout}%.
244
245 --strict
246 Fail whenever an error is found in a package definition or a
247 configuration file. The default is to continue silently if
248 possible.
249
250 --switch=SWITCH
251 Use SWITCH as the current compiler switch. This is equivalent to
252 setting $OPAMSWITCH to SWITCH.
253
254 --use-internal-solver, --no-aspcud
255 Disable any external solver, and use the built-in one (this
256 requires that opam has been compiled with a built-in solver).
257
258 -v, --verbose
259 Be more verbose. One -v shows all package commands, repeat to also
260 display commands called internally (e.g. tar, curl, patch etc.)
261 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
262
263 --version
264 Show version information.
265
266 -w, --working-dir
267 Whenever updating packages that are bound to a local,
268 version-controlled directory, update to the current working state
269 of their source instead of the last committed state, or the ref
270 they are pointing to. This only affects packages explicitly listed
271 on the command-line.
272
273 -y, --yes
274 Answer yes to all yes/no questions without prompting. This is
275 equivalent to setting $OPAMYES to "true".
276
278 Opam makes use of the environment variables listed here. Boolean
279 variables should be set to "0", "no", "false" or the empty string to
280 disable, "1", "yes" or "true" to enable.
281
282 OPAMCOLOR, when set to always or never, sets a default value for the
283 --color option.
284
285 OPAMCRITERIA specifies user preferences for dependency solving. The
286 default value depends on the solver version, use `config report` to
287 know the current setting. See also option --criteria
288
289 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
290 for more options.
291
292 OPAMDEBUG see options `--debug' and `--debug-level'.
293
294 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
295
296 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
297 fails. 0 to print all.
298
299 OPAMEXTERNALSOLVER see option `--solver'.
300
301 OPAMFETCH specifies how to download files: either `wget', `curl' or a
302 custom command where variables %{url}%, %{out}%, %{retry}%,
303 %{compress}% and %{checksum}% will be replaced. Overrides the
304 'download-command' value from the main config file.
305
306 OPAMJOBS sets the maximum number of parallel workers to run.
307
308 OPAMJSON log json output to the given file (use character `%' to index
309 the files)
310
311 OPAMLOCK see option `--lock'.
312
313 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
314 in an earlier format to the current one, on 'update' or 'init'.
315
316 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
317 some backups. This skips some finalisers and may also help to get more
318 reliable backtraces
319
320 OPAMLOCKRETRIES sets the number of tries after which OPAM gives up
321 acquiring its lock and fails. <= 0 means infinite wait.
322
323 OPAMNO answer no to any question asked.
324
325 OPAMNOASPCUD see option `--no-aspcud'.
326
327 OPAMNOSELFUPGRADE see option `--no-self-upgrade'.
328
329 OPAMPINKINDAUTO sets whether version control systems should be detected
330 when pinning to a local path. Enabled by default since 1.3.0.
331
332 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
333 available (e.g. for `opam install`).
334
335 OPAMRETRY sets the number of tries before failing downloads.
336
337 OPAMROOT see option `--root'. This is automatically set by `opam env
338 --root=DIR --set-root'.
339
340 OPAMROOTISOK don't complain when running as root.
341
342 OPAMSAFE see option `--safe'
343
344 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
345 compatibility testing only.
346
347 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
348 60.0, set to 0 for unlimited. Note that all solvers may not support
349 this option.
350
351 OPAMSTATUSLINE display a dynamic status line showing what's currently
352 going on on the terminal. (one of one of `always', `never' or `auto')
353
354 OPAMSWITCH see option `--switch'. Automatically set by `opam env
355 --switch=SWITCH --set-switch'.
356
357 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
358 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
359 are set. See also option --criteria
360
361 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
362
363 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
364 or `auto'). By default `auto', which is determined from the locale).
365
366 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
367 Implies OPAMUTF8. This is set by default on OSX only.
368
369 OPAMVAR_var overrides the contents of the variable var when
370 substituting `%{var}%` strings in `opam` files.
371
372 OPAMVAR_package_var overrides the contents of the variable package:var
373 when substituting `%{package:var}%` strings in `opam` files.
374
375 OPAMVERBOSE see option `--verbose'.
376
377 OPAMYES see option `--yes'.
378
380 As an exception to the following, the `exec' command returns 127 if the
381 command was not found or couldn't be executed, and the command's exit
382 value otherwise.
383
384 0 Success, or true for boolean queries.
385
386 1 False. Returned when a boolean return value is expected, e.g. when
387 running with --check, or for queries like opam lint.
388
389 2 Bad command-line arguments, or command-line arguments pointing to
390 an invalid context (e.g. file not following the expected format).
391
392 5 Not found. You requested something (package, version, repository,
393 etc.) that couldn't be found.
394
395 10 Aborted. The operation required confirmation, which wasn't given.
396
397 15 Could not acquire the locks required for the operation.
398
399 20 There is no solution to the user request. This can be caused by
400 asking to install two incompatible packages, for example.
401
402 30 Error in package definition, or other metadata files. Using
403 --strict raises this error more often.
404
405 31 Package script error. Some package operations were unsuccessful.
406 This may be an error in the packages or an incompatibility with
407 your system. This can be a partial error.
408
409 40 Sync error. Could not fetch some remotes from the network. This can
410 be a partial error.
411
412 50 Configuration error. Opam or system configuration doesn't allow
413 operation, and needs fixing.
414
415 60 Solver failure. The solver failed to return a sound answer. It can
416 be due to a broken external solver, or an error in solver
417 configuration.
418
419 99 Internal error. Something went wrong, likely due to a bug in opam
420 itself.
421
422 130 User interrupt. SIGINT was received, generally due to the user
423 pressing Ctrl-C.
424
426 See https://opam.ocaml.org/doc.
427
429 Vincent Bernardoff <vb@luminar.eu.org>
430 Raja Boujbel <raja.boujbel@ocamlpro.com>
431 Roberto Di Cosmo <roberto@dicosmo.org>
432 Thomas Gazagnaire <thomas@gazagnaire.org>
433 Louis Gesbert <louis.gesbert@ocamlpro.com>
434 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
435 Anil Madhavapeddy <anil@recoil.org>
436 Guillem Rieu <guillem.rieu@ocamlpro.com>
437 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
438 Frederic Tuong <tuong@users.gforge.inria.fr>
439
441 Check bug reports at https://github.com/ocaml/opam/issues.
442
443
444
445Opam 2.0.1 opam-install(1)