1OPAM-REMOVE(1) Opam Manual OPAM-REMOVE(1)
2
3
4
6 opam-remove - Remove a list of packages.
7
9 opam remove [OPTION]… [PACKAGES]…
10
12 This command uninstalls one or more packages currently installed in the
13 currently selected compiler switch. To remove packages installed in
14 another compiler, you need to switch compilers using opam switch or use
15 the --switch flag. This command is the inverse of opam-install.
16
17 If a directory name is specified as package, packages pinned to that
18 directory are both unpinned and removed.
19
21 PACKAGES
22 List of package names, with an optional version or constraint, e.g
23 `pkg', `pkg.1.0' or `pkg>=0.5' ; or directory names containing
24 package description, with explicit directory (e.g. `./srcdir' or
25 `.')
26
28 -a, --auto-remove
29 Remove all the packages which have not been explicitly installed
30 and which are not necessary anymore. It is possible to prevent the
31 removal of an already-installed package by running opam install
32 <pkg> --set-root. This flag can also be set using the
33 $OPAMAUTOREMOVE configuration variable.
34
35 --destdir=DIR
36 Instead of uninstalling the packages, reverts the action of opam
37 install --destdir: remove files corresponding to what the listed
38 packages installed to the current switch from the given DIR. Note
39 that the package needs to still be installed to the same version
40 that was used for install --destdir for this to work reliably. The
41 packages are not removed from the current opam switch when this is
42 specified.
43
44 --force
45 Execute the remove commands of given packages directly, even if
46 they are not considered installed by opam.
47
48 -j JOBS, --jobs=JOBS
49 Set the maximal number of concurrent jobs to use. The default value
50 is calculated from the number of cores. You can also set it using
51 the $OPAMJOBS environment variable.
52
53 --no
54 Answer no to all opam yes/no questions without prompting. See also
55 --confirm-level. This is equivalent to setting $OPAMNO to "true".
56
57 -y, --yes
58 Answer yes to all opam yes/no questions without prompting. See also
59 --confirm-level. This is equivalent to setting $OPAMYES to "true".
60
62 --assume-depexts
63 Skip the installation step for any missing system packages, and
64 attempt to proceed with compilation of the opam packages anyway. If
65 the installation is successful, opam won't prompt again about these
66 system packages. Only meaningful if external dependency handling is
67 enabled.
68
69 -b, --keep-build-dir
70 Keep the build directories after compiling packages. This is
71 equivalent to setting $OPAMKEEPBUILDDIR to "true".
72
73 --build-doc
74 Removed in 2.1, use --with-doc instead.
75
76 --build-test
77 Removed in 2.1, use --with-test instead.
78
79 -d, --with-doc
80 Build the package documentation. This only affects packages listed
81 on the command-line. This is equivalent to setting $OPAMWITHDOC (or
82 the deprecated $OPAMBUILDDOC) to "true".
83
84 --dry-run
85 Simulate the command, but don't actually perform any changes. This
86 also can be set with environment variable $OPAMDEBUG.
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 --dry-run.
92 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 This is equivalent to setting $OPAMIGNORECONSTRAINTS.
100
101 --inplace-build
102 When compiling a package which has its source bound to a local
103 directory, process the build and install actions directly in that
104 directory, rather than in a clean copy handled by opam. This only
105 affects packages that are explicitly listed on the command-line.
106 This is equivalent to setting $OPAMINPLACEBUILD to "true".
107
108 --lock-suffix=SUFFIX (absent=locked)
109 Set locked files suffix to SUFFIX.
110
111 --locked
112 In commands that use opam files found from pinned sources, if a
113 variant of the file with an added .locked extension is found (e.g.
114 foo.opam.locked besides foo.opam), that will be used instead. This
115 is typically useful to offer a more specific set of dependencies
116 and reproduce similar build contexts, hence the name. The
117 lockoption can be used to generate such files, based on the
118 versions of the dependencies currently installed on the host. This
119 is equivalent to setting the $OPAMLOCKED environment variable. Note
120 that this option doesn't generally affect already pinned packages.
121
122 -m MAKE, --make=MAKE
123 Removed in 2.1, use opam config set[-global] make MAKE instead.
124
125 --no-checksums
126 Do not verify the checksum of downloaded archives.This is
127 equivalent to setting $OPAMNOCHECKSUMS to "true".
128
129 --no-depexts
130 Temporarily disables handling of external dependencies. This can be
131 used if a package is not available on your system package manager,
132 but you installed the required dependency by hand. Implies
133 --assume-depexts, and stores the exceptions upon success as well.
134
135 --require-checksums
136 Reject the installation of packages that don't provide a checksum
137 for the upstream archives. This is equivalent to setting
138 $OPAMREQUIRECHECKSUMS to "true".
139
140 --reuse-build-dir
141 Reuse existing build directories (kept by using --keep-build-dir),
142 instead of compiling from a fresh clone of the source. This can be
143 faster, but also lead to failures if the build systems of the
144 packages don't handle upgrades of dependencies well. This is
145 equivalent to setting $OPAMREUSEBUILDDIR to "true".
146
147 --show-actions
148 Call the solver and display the actions. Don't perform any changes.
149 This is equivalent to setting $OPAMSHOW.
150
151 --skip-updates
152 When running an install, upgrade or reinstall on source-pinned
153 packages, they are normally updated from their origin first. This
154 flag disables that behaviour and will keep them to their version in
155 cache. This is equivalent to setting $OPAMSKIPUPDATE.
156
157 -t, --with-test
158 Build and run the package unit-tests. This only affects packages
159 listed on the command-line. This is equivalent to setting
160 $OPAMWITHTEST (or the deprecated $OPAMBUILDTEST) to "true".
161
162 --unlock-base
163 Removed in 2.1, use --update-invariant instead.
164
165 --update-invariant
166 Allow changes to the packages set as switch base (typically, the
167 main compiler). Use with caution. This is equivalent to setting the
168 $OPAMUNLOCKBASE environment variable
169
171 These options are common to all commands.
172
173 --best-effort
174 Don't fail if all requested packages can't be installed: try to
175 install as many as possible. Note that not all external solvers may
176 support this option (recent versions of aspcud or mccs should).
177 This is equivalent to setting $OPAMBESTEFFORT environment variable.
178
179 --cli=MAJOR.MINOR (absent=2.1)
180 Use the command-line interface syntax and semantics of MAJOR.MINOR.
181 Intended for any persistent use of opam (scripts, blog posts,
182 etc.), any version of opam in the same MAJOR series will behave as
183 for the specified MINOR release. The flag was not available in opam
184 2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
185 to 2.0 instead of using this parameter.
186
187 --color=WHEN
188 Colorize the output. WHEN must be one of always, never or auto.
189
190 --confirm-level=LEVEL
191 Confirmation level, LEVEL must be one of ask, no, yes or
192 unsafe-yes. Can be specified more than once. If --yes or --no are
193 also given, the value of the last --confirm-level is taken into
194 account. This is equivalent to setting $OPAMCONFIRMLEVEL`.
195
196 --criteria=CRITERIA
197 Specify user preferences for dependency solving for this run.
198 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
199 on the supported language, and the external solvers available, see
200 http://opam.ocaml.org/doc/External_solvers.html. A general guide to
201 using solver preferences can be found at
202 http://www.dicosmo.org/Articles/usercriteria.pdf.
203
204 --cudf=FILENAME
205 Debug option: Save the CUDF requests sent to the solver to
206 FILENAME-<n>.cudf.
207
208 --debug
209 Print debug message to stderr. This is equivalent to setting
210 $OPAMDEBUG to "true".
211
212 --debug-level=LEVEL
213 Like --debug, but allows specifying the debug level (--debug sets
214 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
215
216 --git-version
217 Print the git version of opam, if set (i.e. you are using a
218 development version), and exit.
219
220 --help[=FMT] (default=auto)
221 Show this help in format FMT. The value FMT must be one of auto,
222 pager, groff or plain. With auto, the format is pager or plain
223 whenever the TERM env var is dumb or undefined.
224
225 --ignore-pin-depends
226 Ignore extra pins required by packages that get pinned, either
227 manually through opam pin or through opam install DIR. This is
228 equivalent to setting IGNOREPINDEPENDS=true.
229
230 --json=FILENAME
231 Save the results of the opam run in a computer-readable file. If
232 the filename contains the character `%', it will be replaced by an
233 index that doesn't overwrite an existing file. Similar to setting
234 the $OPAMJSON variable.
235
236 --no-aspcud
237 Removed in 2.1.
238
239 --no-auto-upgrade
240 When configuring or updating a repository that is written for an
241 earlier opam version (1.2), opam internally converts it to the
242 current format. This disables this behaviour. Note that
243 repositories should define their format version in a 'repo' file at
244 their root, or they will be assumed to be in the older format. It
245 is, in any case, preferable to upgrade the repositories manually
246 using opam admin upgrade [--mirror URL] when possible.
247
248 --no-self-upgrade
249 Opam will replace itself with a newer binary found at OPAMROOT/opam
250 if present. This disables this behaviour.
251
252 -q, --quiet
253 Disables --verbose.
254
255 --root=ROOT
256 Use ROOT as the current root path. This is equivalent to setting
257 $OPAMROOT to ROOT.
258
259 --safe, --readonly
260 Make sure nothing will be automatically updated or rewritten.
261 Useful for calling from completion scripts, for example. Will fail
262 whenever such an operation is needed ; also avoids waiting for
263 locks, skips interactive questions and overrides the $OPAMDEBUG
264 variable. This is equivalent to set environment variable $OPAMSAFE.
265
266 --solver=CMD
267 Specify the CUDF solver to use for resolving package installation
268 problems. This is either a predefined solver (this version of opam
269 supports builtin-mccs+lp(), builtin-mccs+glpk,
270 builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
271 mccs, aspcud-old, packup), or a custom command that should contain
272 the variables %{input}%, %{output}%, %{criteria}%, and optionally
273 %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
274
275 --strict
276 Fail whenever an error is found in a package definition or a
277 configuration file. The default is to continue silently if
278 possible.
279
280 --switch=SWITCH
281 Use SWITCH as the current compiler switch. This is equivalent to
282 setting $OPAMSWITCH to SWITCH.
283
284 --use-internal-solver
285 Disable any external solver, and use the built-in one (this
286 requires that opam has been compiled with a built-in solver). This
287 is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
288
289 -v, --verbose
290 Be more verbose. One -v shows all package commands, repeat to also
291 display commands called internally (e.g. tar, curl, patch etc.)
292 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
293
294 --version
295 Show version information.
296
297 -w, --working-dir
298 Whenever updating packages that are bound to a local,
299 version-controlled directory, update to the current working state
300 of their source instead of the last committed state, or the ref
301 they are pointing to. As source directory is copied as it is, if it
302 isn't clean it may result on a opam build failure.This only affects
303 packages explicitly listed on the command-line.It can also be set
304 with $OPAMWORKINGDIR.
305
307 Opam makes use of the environment variables listed here. Boolean
308 variables should be set to "0", "no", "false" or the empty string to
309 disable, "1", "yes" or "true" to enable.
310
311 OPAMALLPARENS surround all filters with parenthesis.
312
313 OPAMASSUMEDEPEXTS see option `--assume-depexts'.
314
315 OPAMAUTOREMOVE see remove option `--auto-remove'.
316
317 OPAMBESTEFFORT see option `--best-effort'.
318
319 OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
320 the criteria when the `--best-effort' option is set, and is expected to
321 maximise the `opam-query' property in the solution.
322
323 OPAMBUILDDOC Removed in 2.1.
324
325 OPAMBUILDTEST Removed in 2.1.
326
327 OPAMCLI see option `--cli'.
328
329 OPAMCOLOR when set to always or never, sets a default value for the
330 `--color' option.
331
332 OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
333 priority over OPAMYES and OPAMNO.
334
335 OPAMCRITERIA specifies user preferences for dependency solving. The
336 default value depends on the solver version, use `config report' to
337 know the current setting. See also option --criteria.
338
339 OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
340
341 OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
342 preprocessing.
343
344 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
345 for more options.
346
347 OPAMDEBUG see options `--debug' and `--debug-level'.
348
349 OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
350 list of sections. Sections can optionally have a specific debug level
351 (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
352 `--debug-level'.
353
354 OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
355 CUDF preprocessing is.
356
357 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
358
359 OPAMDROPWORKINGDIR overrides packages previously updated with
360 --working-dir on update. Without this variable set, opam would keep
361 them unchanged unless explicitly named on the command-line.
362
363 OPAMDRYRUN see option `--dry-run'.
364
365 OPAMEDITOR sets the editor to use for opam file editing, overrides
366 $EDITOR and $VISUAL.
367
368 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
369 fails. 0 to print all.
370
371 OPAMEXTERNALSOLVER see option `--solver'.
372
373 OPAMFAKE see option `--fake'.
374
375 OPAMFETCH specifies how to download files: either `wget', `curl' or a
376 custom command where variables %{url}%, %{out}%, %{retry}%,
377 %{compress}% and %{checksum}% will be replaced. Overrides the
378 'download-command' value from the main config file.
379
380 OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
381
382 OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
383
384 OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
385
386 OPAMINPLACEBUILD see option `--inplace-build'.
387
388 OPAMJOBS sets the maximum number of parallel workers to run.
389
390 OPAMJSON log json output to the given file (use character `%' to index
391 the files).
392
393 OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
394
395 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
396 some backups. This skips some finalisers and may also help to get more
397 reliable backtraces.
398
399 OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
400
401 OPAMLOGS logdir sets log directory, default is a temporary directory in
402 /tmp
403
404 OPAMMAKECMD set the system make command to use.
405
406 OPAMMERGEOUT merge process outputs, stderr on stdout.
407
408 OPAMNO answer no to any question asked, see options `--no` and
409 `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
410 OPAMYES is set.
411
412 OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
413
414 OPAMNOASPCUD Deprecated.
415
416 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
417 in an earlier format to the current one, on 'update' or 'init'.
418
419 OPAMNOCHECKSUMS enables option --no-checksums when available.
420
421 OPAMNODEPEXTS disables system dependencies handling, see option
422 `--no-depexts'.
423
424 OPAMNOENVNOTICE Internal.
425
426 OPAMNOSELFUPGRADE see option `--no-self-upgrade'
427
428 OPAMPINKINDAUTO sets whether version control systems should be detected
429 when pinning to a local path. Enabled by default since 1.3.0.
430
431 OPAMPRECISETRACKING fine grain tracking of directories.
432
433 OPAMPREPRO set this to false to disable CUDF preprocessing. Less
434 efficient, but might help debugging solver issue.
435
436 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
437 available (e.g. for `opam install').
438
439 OPAMRETRIES sets the number of tries before failing downloads.
440
441 OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
442
443 OPAMROOT see option `--root'. This is automatically set by `opam env
444 --root=DIR --set-root'.
445
446 OPAMROOTISOK don't complain when running as root.
447
448 OPAMSAFE see option `--safe'.
449
450 OPAMSHOW see option `--show'.
451
452 OPAMSKIPUPDATE see option `--skip-updates'.
453
454 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
455 compatibility testing only.
456
457 OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
458 return a solution when they reach timeout; while the solution remains
459 assured to be consistent, there is no guarantee in this case that it
460 fits the expected optimisation criteria. If `true', opam willcontinue
461 with a warning, if `false' a timeout is an error. Currently only the
462 builtin-z3 backend handles this degraded case.
463
464 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
465 60.0, set to 0 for unlimited. Note that all solvers may not support
466 this option.
467
468 OPAMSTATS display stats at the end of command.
469
470 OPAMSTATUSLINE display a dynamic status line showing what's currently
471 going on on the terminal. (one of one of always, never or auto)
472
473 OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
474
475 OPAMSWITCH see option `--switch'. Automatically set by `opam env
476 --switch=SWITCH --set-switch'.
477
478 OPAMUNLOCKBASE see install option `--unlock-base'.
479
480 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
481 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
482 are set. See also option --criteria.
483
484 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
485
486 OPAMUSEOPENSSL force openssl use for hash computing.
487
488 OPAMUTF8 use UTF8 characters in output (one of one of always, never or
489 auto). By default `auto', which is determined from the locale).
490
491 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
492 Implies OPAMUTF8. This is set by default on OSX only.
493
494 OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
495 opam repository update.
496
497 OPAMVERBOSE see option `--verbose'.
498
499 OPAMVERSIONLAGPOWER do not use.
500
501 OPAMWITHDOC see install option `--with-doc'.
502
503 OPAMWITHTEST see install option `--with-test.
504
505 OPAMWORKINGDIR see option `--working-dir'.
506
507 OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
508 priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
509
510 OPAMVAR_var overrides the contents of the variable var when
511 substituting `%{var}%` strings in `opam` files.
512
513 OPAMVAR_package_var overrides the contents of the variable package:var
514 when substituting `%{package:var}%` strings in `opam` files.
515
517 All scripts and programmatic invocations of opam should use `--cli' in
518 order to ensure that they work seamlessly with future versions of the
519 opam client. Additionally, blog posts or other documentation can
520 benefit, as it prevents information from becoming stale.
521
522 Although opam only supports roots (~/.opam/) for the current version,
523 it does provide backwards compatibility for its command-line interface.
524
525 Since CLI version support was only added in opam 2.1, use OPAMCLI to
526 select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
527 for 2.1 (or later) versions, since an environment variable controlling
528 the parsing of syntax is brittle. To this end, opam displays a warning
529 if OPAMCLI specifies a valid version other than 2.0, and also if
530 `--cli=2.0' is specified.
531
532 The command-line version is selected by using the `--cli' option or the
533 OPAMCLI environment variable. `--cli' may be specified morethan once,
534 where the last instance takes precedence. OPAMCLI is only inspected if
535 `--cli' is not given.
536
538 As an exception to the following, the `exec' command returns 127 if the
539 command was not found or couldn't be executed, and the command's exit
540 value otherwise.
541
542 0 Success, or true for boolean queries.
543
544 1 False. Returned when a boolean return value is expected, e.g. when
545 running with --check, or for queries like opam lint.
546
547 2 Bad command-line arguments, or command-line arguments pointing to
548 an invalid context (e.g. file not following the expected format).
549
550 5 Not found. You requested something (package, version, repository,
551 etc.) that couldn't be found.
552
553 10 Aborted. The operation required confirmation, which wasn't given.
554
555 15 Could not acquire the locks required for the operation.
556
557 20 There is no solution to the user request. This can be caused by
558 asking to install two incompatible packages, for example.
559
560 30 Error in package definition, or other metadata files. Using
561 --strict raises this error more often.
562
563 31 Package script error. Some package operations were unsuccessful.
564 This may be an error in the packages or an incompatibility with
565 your system. This can be a partial error.
566
567 40 Sync error. Could not fetch some remotes from the network. This can
568 be a partial error.
569
570 50 Configuration error. Opam or system configuration doesn't allow
571 operation, and needs fixing.
572
573 60 Solver failure. The solver failed to return a sound answer. It can
574 be due to a broken external solver, or an error in solver
575 configuration.
576
577 99 Internal error. Something went wrong, likely due to a bug in opam
578 itself.
579
580 130 User interrupt. SIGINT was received, generally due to the user
581 pressing Ctrl-C.
582
584 See https://opam.ocaml.org/doc.
585
587 Vincent Bernardoff <vb@luminar.eu.org>
588 Raja Boujbel <raja.boujbel@ocamlpro.com>
589 Roberto Di Cosmo <roberto@dicosmo.org>
590 Thomas Gazagnaire <thomas@gazagnaire.org>
591 Louis Gesbert <louis.gesbert@ocamlpro.com>
592 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
593 Anil Madhavapeddy <anil@recoil.org>
594 Guillem Rieu <guillem.rieu@ocamlpro.com>
595
596 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
597 Frederic Tuong <tuong@users.gforge.inria.fr>
598
600 Check bug reports at https://github.com/ocaml/opam/issues.
601
602
603
604Opam 2.1.3 OPAM-REMOVE(1)