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
189 `auto'.
190
191 --confirm-level=LEVEL
192 Confirmation level, LEVEL must be one of `ask', `no', `yes' or
193 `unsafe-yes'. Can be specified more than once. If --yes or --no are
194 also given, the value of the last --confirm-level is taken into
195 account. This is equivalent to setting $OPAMCONFIRMLEVEL`.
196
197 --criteria=CRITERIA
198 Specify user preferences for dependency solving for this run.
199 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
200 on the supported language, and the external solvers available, see
201 http://opam.ocaml.org/doc/External_solvers.html. A general guide to
202 using solver preferences can be found at
203 http://www.dicosmo.org/Articles/usercriteria.pdf.
204
205 --cudf=FILENAME
206 Debug option: Save the CUDF requests sent to the solver to
207 FILENAME-<n>.cudf.
208
209 --debug
210 Print debug message to stderr. This is equivalent to setting
211 $OPAMDEBUG to "true".
212
213 --debug-level=LEVEL
214 Like --debug, but allows specifying the debug level (--debug sets
215 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
216
217 --git-version
218 Print the git version of opam, if set (i.e. you are using a
219 development version), and exit.
220
221 --help[=FMT] (default=auto)
222 Show this help in format FMT. The value FMT must be one of `auto',
223 `pager', `groff' or `plain'. With `auto', the format is `pager` or
224 `plain' whenever the TERM env var is `dumb' or undefined.
225
226 --ignore-pin-depends
227 Ignore extra pins required by packages that get pinned, either
228 manually through opam pin or through opam install DIR. This is
229 equivalent to setting IGNOREPINDEPENDS=true.
230
231 --json=FILENAME
232 Save the results of the opam run in a computer-readable file. If
233 the filename contains the character `%', it will be replaced by an
234 index that doesn't overwrite an existing file. Similar to setting
235 the $OPAMJSON variable.
236
237 --no-aspcud
238 Removed in 2.1.
239
240 --no-auto-upgrade
241 When configuring or updating a repository that is written for an
242 earlier opam version (1.2), opam internally converts it to the
243 current format. This disables this behaviour. Note that
244 repositories should define their format version in a 'repo' file at
245 their root, or they will be assumed to be in the older format. It
246 is, in any case, preferable to upgrade the repositories manually
247 using opam admin upgrade [--mirror URL] when possible.
248
249 --no-self-upgrade
250 Opam will replace itself with a newer binary found at OPAMROOT/opam
251 if present. This disables this behaviour.
252
253 -q, --quiet
254 Disables --verbose.
255
256 --root=ROOT
257 Use ROOT as the current root path. This is equivalent to setting
258 $OPAMROOT to ROOT.
259
260 --safe, --readonly
261 Make sure nothing will be automatically updated or rewritten.
262 Useful for calling from completion scripts, for example. Will fail
263 whenever such an operation is needed ; also avoids waiting for
264 locks, skips interactive questions and overrides the $OPAMDEBUG
265 variable. This is equivalent to set environment variable $OPAMSAFE.
266
267 --solver=CMD
268 Specify the CUDF solver to use for resolving package installation
269 problems. This is either a predefined solver (this version of opam
270 supports builtin-mccs+lp(), builtin-mccs+glpk,
271 builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
272 mccs, aspcud-old, packup), or a custom command that should contain
273 the variables %{input}%, %{output}%, %{criteria}%, and optionally
274 %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
275
276 --strict
277 Fail whenever an error is found in a package definition or a
278 configuration file. The default is to continue silently if
279 possible.
280
281 --switch=SWITCH
282 Use SWITCH as the current compiler switch. This is equivalent to
283 setting $OPAMSWITCH to SWITCH.
284
285 --use-internal-solver
286 Disable any external solver, and use the built-in one (this
287 requires that opam has been compiled with a built-in solver). This
288 is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
289
290 -v, --verbose
291 Be more verbose. One -v shows all package commands, repeat to also
292 display commands called internally (e.g. tar, curl, patch etc.)
293 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
294
295 --version
296 Show version information.
297
298 -w, --working-dir
299 Whenever updating packages that are bound to a local,
300 version-controlled directory, update to the current working state
301 of their source instead of the last committed state, or the ref
302 they are pointing to. As source directory is copied as it is, if it
303 isn't clean it may result on a opam build failure.This only affects
304 packages explicitly listed on the command-line.It can also be set
305 with $OPAMWORKINGDIR.
306
308 Opam makes use of the environment variables listed here. Boolean
309 variables should be set to "0", "no", "false" or the empty string to
310 disable, "1", "yes" or "true" to enable.
311
312 OPAMALLPARENS surround all filters with parenthesis.
313
314 OPAMASSUMEDEPEXTS see option `--assume-depexts'.
315
316 OPAMAUTOREMOVE see remove option `--auto-remove'.
317
318 OPAMBESTEFFORT see option `--best-effort'.
319
320 OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
321 the criteria when the `--best-effort' option is set, and is expected to
322 maximise the `opam-query' property in the solution.
323
324 OPAMBUILDDOC Removed in 2.1.
325
326 OPAMBUILDTEST Removed in 2.1.
327
328 OPAMCLI see option `--cli'.
329
330 OPAMCOLOR when set to always or never, sets a default value for the
331 `--color' option.
332
333 OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
334 priority over OPAMYES and OPAMNO.
335
336 OPAMCRITERIA specifies user preferences for dependency solving. The
337 default value depends on the solver version, use `config report' to
338 know the current setting. See also option --criteria.
339
340 OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
341
342 OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
343 preprocessing.
344
345 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
346 for more options.
347
348 OPAMDEBUG see options `--debug' and `--debug-level'.
349
350 OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
351 list of sections. Sections can optionally have a specific debug level
352 (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
353 `--debug-level'.
354
355 OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
356 CUDF preprocessing is.
357
358 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
359
360 OPAMDROPWORKINGDIR overrides packages previously updated with
361 --working-dir on update. Without this variable set, opam would keep
362 them unchanged unless explicitly named on the command-line.
363
364 OPAMDRYRUN see option `--dry-run'.
365
366 OPAMEDITOR sets the editor to use for opam file editing, overrides
367 $EDITOR and $VISUAL.
368
369 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
370 fails. 0 to print all.
371
372 OPAMEXTERNALSOLVER see option `--solver'.
373
374 OPAMFAKE see option `--fake'.
375
376 OPAMFETCH specifies how to download files: either `wget', `curl' or a
377 custom command where variables %{url}%, %{out}%, %{retry}%,
378 %{compress}% and %{checksum}% will be replaced. Overrides the
379 'download-command' value from the main config file.
380
381 OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
382
383 OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
384
385 OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
386
387 OPAMINPLACEBUILD see option `--inplace-build'.
388
389 OPAMJOBS sets the maximum number of parallel workers to run.
390
391 OPAMJSON log json output to the given file (use character `%' to index
392 the files).
393
394 OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
395
396 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
397 some backups. This skips some finalisers and may also help to get more
398 reliable backtraces.
399
400 OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
401
402 OPAMLOGS logdir sets log directory, default is a temporary directory in
403 /tmp
404
405 OPAMMAKECMD set the system make command to use.
406
407 OPAMMERGEOUT merge process outputs, stderr on stdout.
408
409 OPAMNO answer no to any question asked, see options `--no` and
410 `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
411 OPAMYES is set.
412
413 OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
414
415 OPAMNOASPCUD Deprecated.
416
417 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
418 in an earlier format to the current one, on 'update' or 'init'.
419
420 OPAMNOCHECKSUMS enables option --no-checksums when available.
421
422 OPAMNODEPEXTS disables system dependencies handling, see option
423 `--no-depexts'.
424
425 OPAMNOENVNOTICE Internal.
426
427 OPAMNOSELFUPGRADE see option `--no-self-upgrade'
428
429 OPAMPINKINDAUTO sets whether version control systems should be detected
430 when pinning to a local path. Enabled by default since 1.3.0.
431
432 OPAMPRECISETRACKING fine grain tracking of directories.
433
434 OPAMPREPRO set this to false to disable CUDF preprocessing. Less
435 efficient, but might help debugging solver issue.
436
437 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
438 available (e.g. for `opam install').
439
440 OPAMRETRIES sets the number of tries before failing downloads.
441
442 OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
443
444 OPAMROOT see option `--root'. This is automatically set by `opam env
445 --root=DIR --set-root'.
446
447 OPAMROOTISOK don't complain when running as root.
448
449 OPAMSAFE see option `--safe'.
450
451 OPAMSHOW see option `--show'.
452
453 OPAMSKIPUPDATE see option `--skip-updates'.
454
455 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
456 compatibility testing only.
457
458 OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
459 return a solution when they reach timeout; while the solution remains
460 assured to be consistent, there is no guarantee in this case that it
461 fits the expected optimisation criteria. If `true', opam willcontinue
462 with a warning, if `false' a timeout is an error. Currently only the
463 builtin-z3 backend handles this degraded case.
464
465 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
466 60.0, set to 0 for unlimited. Note that all solvers may not support
467 this option.
468
469 OPAMSTATS display stats at the end of command.
470
471 OPAMSTATUSLINE display a dynamic status line showing what's currently
472 going on on the terminal. (one of one of `always', `never' or `auto')
473
474 OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
475
476 OPAMSWITCH see option `--switch'. Automatically set by `opam env
477 --switch=SWITCH --set-switch'.
478
479 OPAMUNLOCKBASE see install option `--unlock-base'.
480
481 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
482 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
483 are set. See also option --criteria.
484
485 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
486
487 OPAMUSEOPENSSL force openssl use for hash computing.
488
489 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
490 or `auto'). By default `auto', which is determined from the locale).
491
492 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
493 Implies OPAMUTF8. This is set by default on OSX only.
494
495 OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
496 opam repository update.
497
498 OPAMVERBOSE see option `--verbose'.
499
500 OPAMVERSIONLAGPOWER do not use.
501
502 OPAMWITHDOC see install option `--with-doc'.
503
504 OPAMWITHTEST see install option `--with-test.
505
506 OPAMWORKINGDIR see option `--working-dir'.
507
508 OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
509 priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
510
511 OPAMVAR_var overrides the contents of the variable var when
512 substituting `%{var}%` strings in `opam` files.
513
514 OPAMVAR_package_var overrides the contents of the variable package:var
515 when substituting `%{package:var}%` strings in `opam` files.
516
518 All scripts and programmatic invocations of opam should use `--cli' in
519 order to ensure that they work seamlessly with future versions of the
520 opam client. Additionally, blog posts or other documentation can
521 benefit, as it prevents information from becoming stale.
522
523 Although opam only supports roots (~/.opam/) for the current version,
524 it does provide backwards compatibility for its command-line interface.
525
526 Since CLI version support was only added in opam 2.1, use OPAMCLI to
527 select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
528 for 2.1 (or later) versions, since an environment variable controlling
529 the parsing of syntax is brittle. To this end, opam displays a warning
530 if OPAMCLI specifies a valid version other than 2.0, and also if
531 `--cli=2.0' is specified.
532
533 The command-line version is selected by using the `--cli' option or the
534 OPAMCLI environment variable. `--cli' may be specified morethan once,
535 where the last instance takes precedence. OPAMCLI is only inspected if
536 `--cli' is not given.
537
539 As an exception to the following, the `exec' command returns 127 if the
540 command was not found or couldn't be executed, and the command's exit
541 value otherwise.
542
543 0 Success, or true for boolean queries.
544
545 1 False. Returned when a boolean return value is expected, e.g. when
546 running with --check, or for queries like opam lint.
547
548 2 Bad command-line arguments, or command-line arguments pointing to
549 an invalid context (e.g. file not following the expected format).
550
551 5 Not found. You requested something (package, version, repository,
552 etc.) that couldn't be found.
553
554 10 Aborted. The operation required confirmation, which wasn't given.
555
556 15 Could not acquire the locks required for the operation.
557
558 20 There is no solution to the user request. This can be caused by
559 asking to install two incompatible packages, for example.
560
561 30 Error in package definition, or other metadata files. Using
562 --strict raises this error more often.
563
564 31 Package script error. Some package operations were unsuccessful.
565 This may be an error in the packages or an incompatibility with
566 your system. This can be a partial error.
567
568 40 Sync error. Could not fetch some remotes from the network. This can
569 be a partial error.
570
571 50 Configuration error. Opam or system configuration doesn't allow
572 operation, and needs fixing.
573
574 60 Solver failure. The solver failed to return a sound answer. It can
575 be due to a broken external solver, or an error in solver
576 configuration.
577
578 99 Internal error. Something went wrong, likely due to a bug in opam
579 itself.
580
581 130 User interrupt. SIGINT was received, generally due to the user
582 pressing Ctrl-C.
583
585 See https://opam.ocaml.org/doc.
586
588 Vincent Bernardoff <vb@luminar.eu.org>
589 Raja Boujbel <raja.boujbel@ocamlpro.com>
590 Roberto Di Cosmo <roberto@dicosmo.org>
591 Thomas Gazagnaire <thomas@gazagnaire.org>
592 Louis Gesbert <louis.gesbert@ocamlpro.com>
593 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
594 Anil Madhavapeddy <anil@recoil.org>
595 Guillem Rieu <guillem.rieu@ocamlpro.com>
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.1 OPAM-REMOVE(1)