1OPAM-CLEAN(1)                     Opam Manual                    OPAM-CLEAN(1)
2
3
4

NAME

6       opam-clean - Cleans up opam caches
7

SYNOPSIS

9       opam clean [OPTION]...
10

DESCRIPTION

12       Cleans up opam caches, reclaiming some disk space. If no options are
13       specified, the default is --logs --download-cache --switch-cleanup.
14

OPTIONS

16       -a, --all-switches
17           Run the switch cleanup commands in all switches. Implies
18           --switch-cleanup
19
20       -c, --download-cache
21           Clear the cache of downloaded files ($OPAMROOT/download-cache), as
22           well as the obsolete $OPAMROOT/archives, if that exists.
23
24       --dry-run
25           Print the removal commands, but don't execute them
26
27       --logs
28           Clear the logs directory.
29
30       --no
31           Answer no to all opam yes/no questions without prompting. See also
32           --confirm-level. This is equivalent to setting $OPAMNO to "true".
33
34       -r, --repo-cache
35           Clear the repository cache. It will be rebuilt by the next opam
36           command that needs it.
37
38       -s, --switch-cleanup
39           Run the switch-specific cleanup: clears backups, build dirs,
40           uncompressed package sources of non-dev packages, local metadata of
41           previously pinned packages, etc.
42
43       --unused-repositories
44           Clear any configured repository that is not used by any switch nor
45           the default.
46
47       -y, --yes
48           Answer yes to all opam yes/no questions without prompting. See also
49           --confirm-level. This is equivalent to setting $OPAMYES to "true".
50

COMMON OPTIONS

52       These options are common to all commands.
53
54       --best-effort
55           Don't fail if all requested packages can't be installed: try to
56           install as many as possible. Note that not all external solvers may
57           support this option (recent versions of aspcud or mccs should).
58           This is equivalent to setting $OPAMBESTEFFORT environment variable.
59
60       --cli=MAJOR.MINOR (absent=2.1)
61           Use the command-line interface syntax and semantics of MAJOR.MINOR.
62           Intended for any persistent use of opam (scripts, blog posts,
63           etc.), any version of opam in the same MAJOR series will behave as
64           for the specified MINOR release. The flag was not available in opam
65           2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
66           to 2.0 instead of using this parameter.
67
68       --color=WHEN
69           Colorize the output. WHEN must be one of `always', `never' or
70           `auto'.
71
72       --confirm-level=LEVEL
73           Confirmation level, LEVEL must be one of `ask', `no', `yes' or
74           `unsafe-yes'. Can be specified more than once. If --yes or --no are
75           also given, the value of the last --confirm-level is taken into
76           account. This is equivalent to setting  $OPAMCONFIRMLEVEL`.
77
78       --criteria=CRITERIA
79           Specify user preferences for dependency solving for this run.
80           Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
81           on the supported language, and the external solvers available, see
82           http://opam.ocaml.org/doc/External_solvers.html. A general guide to
83           using solver preferences can be found at
84           http://www.dicosmo.org/Articles/usercriteria.pdf.
85
86       --cudf=FILENAME
87           Debug option: Save the CUDF requests sent to the solver to
88           FILENAME-<n>.cudf.
89
90       --debug
91           Print debug message to stderr. This is equivalent to setting
92           $OPAMDEBUG to "true".
93
94       --debug-level=LEVEL
95           Like --debug, but allows specifying the debug level (--debug sets
96           it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
97
98       --git-version
99           Print the git version of opam, if set (i.e. you are using a
100           development version), and exit.
101
102       --help[=FMT] (default=auto)
103           Show this help in format FMT. The value FMT must be one of `auto',
104           `pager', `groff' or `plain'. With `auto', the format is `pager` or
105           `plain' whenever the TERM env var is `dumb' or undefined.
106
107       --ignore-pin-depends
108           Ignore extra pins required by packages that get pinned, either
109           manually through opam pin or through opam install DIR. This is
110           equivalent to setting IGNOREPINDEPENDS=true.
111
112       --json=FILENAME
113           Save the results of the opam run in a computer-readable file. If
114           the filename contains the character `%', it will be replaced by an
115           index that doesn't overwrite an existing file. Similar to setting
116           the $OPAMJSON variable.
117
118       --no-aspcud
119           Removed in 2.1.
120
121       --no-auto-upgrade
122           When configuring or updating a repository that is written for an
123           earlier opam version (1.2), opam internally converts it to the
124           current format. This disables this behaviour. Note that
125           repositories should define their format version in a 'repo' file at
126           their root, or they will be assumed to be in the older format. It
127           is, in any case, preferable to upgrade the repositories manually
128           using opam admin upgrade [--mirror URL] when possible.
129
130       --no-self-upgrade
131           Opam will replace itself with a newer binary found at OPAMROOT/opam
132           if present. This disables this behaviour.
133
134       -q, --quiet
135           Disables --verbose.
136
137       --root=ROOT
138           Use ROOT as the current root path. This is equivalent to setting
139           $OPAMROOT to ROOT.
140
141       --safe, --readonly
142           Make sure nothing will be automatically updated or rewritten.
143           Useful for calling from completion scripts, for example. Will fail
144           whenever such an operation is needed ; also avoids waiting for
145           locks, skips interactive questions and overrides the $OPAMDEBUG
146           variable. This is equivalent to set environment variable $OPAMSAFE.
147
148       --solver=CMD
149           Specify the CUDF solver to use for resolving package installation
150           problems. This is either a predefined solver (this version of opam
151           supports builtin-mccs+lp(), builtin-mccs+glpk,
152           builtin-dummy-z3-solver, builtin-dummy-0install-solver, aspcud,
153           mccs, aspcud-old, packup), or a custom command that should contain
154           the variables %{input}%, %{output}%, %{criteria}%, and optionally
155           %{timeout}%. This is equivalent to setting $OPAMEXTERNALSOLVER.
156
157       --strict
158           Fail whenever an error is found in a package definition or a
159           configuration file. The default is to continue silently if
160           possible.
161
162       --switch=SWITCH
163           Use SWITCH as the current compiler switch. This is equivalent to
164           setting $OPAMSWITCH to SWITCH.
165
166       --use-internal-solver
167           Disable any external solver, and use the built-in one (this
168           requires that opam has been compiled with a built-in solver). This
169           is equivalent to setting $OPAMNOASPCUD or $OPAMUSEINTERNALSOLVER.
170
171       -v, --verbose
172           Be more verbose. One -v shows all package commands, repeat to also
173           display commands called internally (e.g. tar, curl, patch etc.)
174           Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
175
176       --version
177           Show version information.
178
179       -w, --working-dir
180           Whenever updating packages that are bound to a local,
181           version-controlled directory, update to the current working state
182           of their source instead of the last committed state, or the ref
183           they are pointing to. As source directory is copied as it is, if it
184           isn't clean it may result on a opam build failure.This only affects
185           packages explicitly listed on the command-line.It can also be set
186           with $OPAMWORKINGDIR.
187

ENVIRONMENT

189       Opam makes use of the environment variables listed here. Boolean
190       variables should be set to "0", "no", "false" or the empty string to
191       disable, "1", "yes" or "true" to enable.
192
193       OPAMALLPARENS surround all filters with parenthesis.
194
195       OPAMASSUMEDEPEXTS see option `--assume-depexts'.
196
197       OPAMAUTOREMOVE see remove option `--auto-remove'.
198
199       OPAMBESTEFFORT see option `--best-effort'.
200
201       OPAMBESTEFFORTPREFIXCRITERIA sets the string that must be prepended to
202       the criteria when the `--best-effort' option is set, and is expected to
203       maximise the `opam-query' property in the solution.
204
205       OPAMBUILDDOC Removed in 2.1.
206
207       OPAMBUILDTEST Removed in 2.1.
208
209       OPAMCLI see option `--cli'.
210
211       OPAMCOLOR when set to always or never, sets a default value for the
212       `--color' option.
213
214       OPAMCONFIRMLEVEL see option `--confirm-level`. OPAMCONFIRMLEVEL has
215       priority over OPAMYES and OPAMNO.
216
217       OPAMCRITERIA specifies user preferences for dependency solving. The
218       default value depends on the solver version, use `config report' to
219       know the current setting. See also option --criteria.
220
221       OPAMCUDFFILE save the cudf graph to file-actions-explicit.dot.
222
223       OPAMCUDFTRIM controls the filtering of unrelated packages during CUDF
224       preprocessing.
225
226       OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
227       for more options.
228
229       OPAMDEBUG see options `--debug' and `--debug-level'.
230
231       OPAMDEBUGSECTIONS if set, limits debug messages to the space-separated
232       list of sections. Sections can optionally have a specific debug level
233       (for example, CLIENT:2 or CLIENT CUDF:2), but otherwise use
234       `--debug-level'.
235
236       OPAMDIGDEPTH defines how aggressive the lookup for conflicts during
237       CUDF preprocessing is.
238
239       OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
240
241       OPAMDROPWORKINGDIR overrides packages previously updated with
242       --working-dir on update. Without this variable set, opam would keep
243       them unchanged unless explicitly named on the command-line.
244
245       OPAMDRYRUN see option `--dry-run'.
246
247       OPAMEDITOR sets the editor to use for opam file editing, overrides
248       $EDITOR and $VISUAL.
249
250       OPAMERRLOGLEN sets the number of log lines printed when a sub-process
251       fails. 0 to print all.
252
253       OPAMEXTERNALSOLVER see option `--solver'.
254
255       OPAMFAKE see option `--fake'.
256
257       OPAMFETCH specifies how to download files: either `wget', `curl' or a
258       custom command where variables %{url}%, %{out}%, %{retry}%,
259       %{compress}% and %{checksum}% will be replaced. Overrides the
260       'download-command' value from the main config file.
261
262       OPAMFIXUPCRITERIA same as OPAMUPGRADECRITERIA, but specific to fixup.
263
264       OPAMIGNORECONSTRAINTS see install option `--ignore-constraints-on'.
265
266       OPAMIGNOREPINDEPENDS see option `--ignore-pin-depends'.
267
268       OPAMINPLACEBUILD see option `--inplace-build'.
269
270       OPAMJOBS sets the maximum number of parallel workers to run.
271
272       OPAMJSON log json output to the given file (use character `%' to index
273       the files).
274
275       OPAMKEEPBUILDDIR see install option `--keep-build-dir'.
276
277       OPAMKEEPLOGS tells opam to not remove some temporary command logs and
278       some backups. This skips some finalisers and may also help to get more
279       reliable backtraces.
280
281       OPAMLOCKED combination of `--locked' and `--lock-suffix' options.
282
283       OPAMLOGS logdir sets log directory, default is a temporary directory in
284       /tmp
285
286       OPAMMAKECMD set the system make command to use.
287
288       OPAMMERGEOUT merge process outputs, stderr on stdout.
289
290       OPAMNO answer no to any question asked, see options `--no` and
291       `--confirm-level`. OPAMNO is ignored if either OPAMCONFIRMLEVEL or
292       OPAMYES is set.
293
294       OPAMNOAGGREGATE with `opam admin check', don't aggregate packages.
295
296       OPAMNOASPCUD Deprecated.
297
298       OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
299       in an earlier format to the current one, on 'update' or 'init'.
300
301       OPAMNOCHECKSUMS enables option --no-checksums when available.
302
303       OPAMNODEPEXTS disables system dependencies handling, see option
304       `--no-depexts'.
305
306       OPAMNOENVNOTICE Internal.
307
308       OPAMNOSELFUPGRADE see option `--no-self-upgrade'
309
310       OPAMPINKINDAUTO sets whether version control systems should be detected
311       when pinning to a local path. Enabled by default since 1.3.0.
312
313       OPAMPRECISETRACKING fine grain tracking of directories.
314
315       OPAMPREPRO set this to false to disable CUDF preprocessing. Less
316       efficient, but might help debugging solver issue.
317
318       OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
319       available (e.g. for `opam install').
320
321       OPAMRETRIES sets the number of tries before failing downloads.
322
323       OPAMREUSEBUILDDIR see option `--reuse-build-dir'.
324
325       OPAMROOT see option `--root'. This is automatically set by `opam env
326       --root=DIR --set-root'.
327
328       OPAMROOTISOK don't complain when running as root.
329
330       OPAMSAFE see option `--safe'.
331
332       OPAMSHOW see option `--show'.
333
334       OPAMSKIPUPDATE see option `--skip-updates'.
335
336       OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
337       compatibility testing only.
338
339       OPAMSOLVERALLOWSUBOPTIMAL (default `true') allows some solvers to still
340       return a solution when they reach timeout; while the solution remains
341       assured to be consistent, there is no guarantee in this case that it
342       fits the expected optimisation criteria. If `true', opam willcontinue
343       with a warning, if `false' a timeout is an error. Currently only the
344       builtin-z3 backend handles this degraded case.
345
346       OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
347       60.0, set to 0 for unlimited. Note that all solvers may not support
348       this option.
349
350       OPAMSTATS display stats at the end of command.
351
352       OPAMSTATUSLINE display a dynamic status line showing what's currently
353       going on on the terminal. (one of one of `always', `never' or `auto')
354
355       OPAMSTRICT fail on inconsistencies (file reading, switch import, etc.).
356
357       OPAMSWITCH see option `--switch'. Automatically set by `opam env
358       --switch=SWITCH --set-switch'.
359
360       OPAMUNLOCKBASE see install option `--unlock-base'.
361
362       OPAMUPGRADECRITERIA specifies user preferences for dependency solving
363       when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
364       are set. See also option --criteria.
365
366       OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
367
368       OPAMUSEOPENSSL force openssl use for hash computing.
369
370       OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
371       or `auto'). By default `auto', which is determined from the locale).
372
373       OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
374       Implies OPAMUTF8. This is set by default on OSX only.
375
376       OPAMVALIDATIONHOOK if set, uses the `%{hook%}' command to validate an
377       opam repository update.
378
379       OPAMVERBOSE see option `--verbose'.
380
381       OPAMVERSIONLAGPOWER do not use.
382
383       OPAMWITHDOC see install option `--with-doc'.
384
385       OPAMWITHTEST see install option `--with-test.
386
387       OPAMWORKINGDIR see option `--working-dir'.
388
389       OPAMYES see options `--yes' and `--confirm-level`. OPAMYES has has
390       priority over OPAMNO and is ignored if OPAMCONFIRMLEVEL is set.
391
392       OPAMVAR_var overrides the contents of the variable var when
393       substituting `%{var}%` strings in `opam` files.
394
395       OPAMVAR_package_var overrides the contents of the variable package:var
396       when substituting `%{package:var}%` strings in `opam` files.
397

CLI VERSION

399       All scripts and programmatic invocations of opam should use `--cli' in
400       order to ensure that they work seamlessly with future versions of the
401       opam client. Additionally, blog posts or other documentation can
402       benefit, as it prevents information from becoming stale.
403
404       Although opam only supports roots (~/.opam/) for the current version,
405       it does provide backwards compatibility for its command-line interface.
406
407       Since CLI version support was only added in opam 2.1, use OPAMCLI to
408       select 2.0 support (as opam 2.0 will just ignore it), and `--cli=2.1'
409       for 2.1 (or later) versions, since an environment variable controlling
410       the parsing of syntax is brittle. To this end, opam displays a warning
411       if OPAMCLI specifies a valid version other than 2.0, and also if
412       `--cli=2.0' is specified.
413
414       The command-line version is selected by using the `--cli' option or the
415       OPAMCLI environment variable. `--cli' may be specified morethan once,
416       where the last instance takes precedence. OPAMCLI is only inspected if
417       `--cli' is not given.
418

EXIT STATUS

420       As an exception to the following, the `exec' command returns 127 if the
421       command was not found or couldn't be executed, and the command's exit
422       value otherwise.
423
424       0   Success, or true for boolean queries.
425
426       1   False. Returned when a boolean return value is expected, e.g. when
427           running with --check, or for queries like opam lint.
428
429       2   Bad command-line arguments, or command-line arguments pointing to
430           an invalid context (e.g. file not following the expected format).
431
432       5   Not found. You requested something (package, version, repository,
433           etc.) that couldn't be found.
434
435       10  Aborted. The operation required confirmation, which wasn't given.
436
437       15  Could not acquire the locks required for the operation.
438
439       20  There is no solution to the user request. This can be caused by
440           asking to install two incompatible packages, for example.
441
442       30  Error in package definition, or other metadata files. Using
443           --strict raises this error more often.
444
445       31  Package script error. Some package operations were unsuccessful.
446           This may be an error in the packages or an incompatibility with
447           your system. This can be a partial error.
448
449       40  Sync error. Could not fetch some remotes from the network. This can
450           be a partial error.
451
452       50  Configuration error. Opam or system configuration doesn't allow
453           operation, and needs fixing.
454
455       60  Solver failure. The solver failed to return a sound answer. It can
456           be due to a broken external solver, or an error in solver
457           configuration.
458
459       99  Internal error. Something went wrong, likely due to a bug in opam
460           itself.
461
462       130 User interrupt. SIGINT was received, generally due to the user
463           pressing Ctrl-C.
464

FURTHER DOCUMENTATION

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

AUTHORS

469       Vincent Bernardoff <vb@luminar.eu.org>
470       Raja Boujbel <raja.boujbel@ocamlpro.com>
471       Roberto Di Cosmo <roberto@dicosmo.org>
472       Thomas Gazagnaire <thomas@gazagnaire.org>
473       Louis Gesbert <louis.gesbert@ocamlpro.com>
474       Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
475       Anil Madhavapeddy <anil@recoil.org>
476       Guillem Rieu <guillem.rieu@ocamlpro.com>
477       Ralf Treinen <ralf.treinen@pps.jussieu.fr>
478       Frederic Tuong <tuong@users.gforge.inria.fr>
479

BUGS

481       Check bug reports at https://github.com/ocaml/opam/issues.
482
483
484
485Opam 2.1.2                                                       OPAM-CLEAN(1)
Impressum