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