1opam-config(1) Opam Manual opam-config(1)
2
3
4
6 opam-config - Display configuration options for packages.
7
9 opam config [OPTION]... [COMMAND] [ARG]...
10
12 This command uses opam state to output information on how to use
13 installed libraries, update the PATH, and substitute variables used in
14 opam packages.
15
16 Apart from opam config env, most of these commands are used by opam
17 internally, and are of limited interest for the casual user.
18
20 env Returns the bindings for the environment variables set in the
21 current switch, e.g. PATH, in a format intended to be evaluated by
22 a shell. With -v, add comments documenting the reason or package of
23 origin for each binding. This is most usefully used as eval $(opam
24 config env) to have further shell commands be evaluated in the
25 proper opam context. Can also be accessed through opam env.
26
27 revert-env
28 Reverts environment changes made by opam, e.g. eval $(opam config
29 revert-env) undoes what eval $(opam config env) did, as much as
30 possible.
31
32 exec [--] COMMAND [ARG]...
33 Execute COMMAND with the correct environment variables. This
34 command can be used to cross-compile between switches using opam
35 config exec --switch=SWITCH -- COMMAND ARG1 ... ARGn. Opam
36 expansion takes place in command and args. If no switch is present
37 on the command line or in the OPAMSWITCH environment variable,
38 OPAMSWITCH is not set in COMMAND's environment. Can also be
39 accessed through opam exec.
40
41 var VAR
42 Return the value associated with variable VAR. Package variables
43 can be accessed with the syntax pkg:var. Can also be accessed
44 through opam var
45
46 list [PACKAGE]...
47 Without argument, prints a documented list of all available
48 variables. With PACKAGE, lists all the variables available for
49 these packages. Use - to include global configuration variables for
50 this switch.
51
52 set VAR VALUE
53 Set the given opam variable for the current switch. Warning:
54 changing a configured path will not move any files! This command
55 does not perform any variable expansion.
56
57 unset VAR
58 Unset the given opam variable for the current switch. Warning:
59 unsetting built-in configuration variables can cause problems!
60
61 set-global VAR VALUE
62 Set the given variable globally in the opam root, to be visible in
63 all switches
64
65 unset-global VAR
66 Unset the given global variable
67
68 expand STRING
69 Expand variable interpolations in the given string
70
71 subst FILE...
72 Substitute variables in the given files. The strings %{var}% are
73 replaced by the value of variable var (see var).
74
75 report
76 Prints a summary of your setup, useful for bug-reports.
77
78 cudf-universe [FILE]
79 Outputs the current available package universe in CUDF format.
80
81 pef-universe [FILE]
82 Outputs the current package universe in PEF format.
83
85 --inplace-path
86 When updating the PATH variable, replace any pre-existing opam path
87 in-place rather than putting the new path in front. This means
88 programs installed in opam that were shadowed will remain so after
89 opam env
90
91 --set-root
92 With the env and exec subcommands, also sets the OPAMROOT variable,
93 making sure further calls to opam will use the same root.
94
95 --set-switch
96 With the env and exec subcommands, also sets the OPAMSWITCH
97 variable, making sure further calls to opam will use the same
98 switch as this one.
99
100 --sexp
101 Print environment as an s-expression rather than in shell format
102
103 --shell=SHELL
104 Sets the configuration mode for opam environment appropriate for
105 SHELL. One of one of `bash', `sh', `csh', `zsh' or `fish'. Guessed
106 from the parent processes and the $SHELL variable by default.
107
109 These options are common to all commands.
110
111 --best-effort
112 Don't fail if all requested packages can't be installed: try to
113 install as many as possible. Note that not all external solvers may
114 support this option (recent versions of aspcud or mccs should).
115
116 --color=WHEN
117 Colorize the output. WHEN must be one of `always', `never' or
118 `auto'.
119
120 --criteria=CRITERIA
121 Specify user preferences for dependency solving for this run.
122 Overrides both $OPAMCRITERIA and $OPAMUPGRADECRITERIA. For details
123 on the supported language, and the external solvers available, see
124 http://opam.ocaml.org/doc/Specifying_Solver_Preferences.html. A
125 general guide to using solver preferences can be found at
126 http://www.dicosmo.org/Articles/usercriteria.pdf.
127
128 --cudf=FILENAME
129 Debug option: Save the CUDF requests sent to the solver to
130 FILENAME-<n>.cudf.
131
132 --debug
133 Print debug message to stderr. This is equivalent to setting
134 $OPAMDEBUG to "true".
135
136 --debug-level=LEVEL
137 Like --debug, but allows specifying the debug level (--debug sets
138 it to 1). Equivalent to setting $OPAMDEBUG to a positive integer.
139
140 --git-version
141 Print the git version of opam, if set (i.e. you are using a
142 development version), and exit.
143
144 --help[=FMT] (default=auto)
145 Show this help in format FMT. The value FMT must be one of `auto',
146 `pager', `groff' or `plain'. With `auto', the format is `pager` or
147 `plain' whenever the TERM env var is `dumb' or undefined.
148
149 --ignore-pin-depends
150 Ignore extra pins required by packages that get pinned, either
151 manually through opam pin or through opam install DIR. This is
152 equivalent to setting IGNOREPINDEPENDS=true.
153
154 --json=FILENAME
155 Save the results of the opam run in a computer-readable file. If
156 the filename contains the character `%', it will be replaced by an
157 index that doesn't overwrite an existing file. Similar to setting
158 the $OPAMJSON variable.
159
160 --no-auto-upgrade
161 When configuring or updating a repository that is written for an
162 earlier opam version (1.2), opam internally converts it to the
163 current format. This disables this behaviour. Note that
164 repositories should define their format version in a 'repo' file at
165 their root, or they will be assumed to be in the older format. It
166 is, in any case, preferable to upgrade the repositories manually
167 using opam admin upgrade [--mirror URL] when possible.
168
169 --no-self-upgrade
170 Opam will replace itself with a newer binary found at OPAMROOT/opam
171 if present. This disables this behaviour.
172
173 -q, --quiet
174 Disables --verbose.
175
176 --root=ROOT
177 Use ROOT as the current root path. This is equivalent to setting
178 $OPAMROOT to ROOT.
179
180 --safe, --readonly
181 Make sure nothing will be automatically updated or rewritten.
182 Useful for calling from completion scripts, for example. Will fail
183 whenever such an operation is needed ; also avoids waiting for
184 locks, skips interactive questions and overrides the $OPAMDEBUG
185 variable.
186
187 --solver=CMD
188 Specify the CUDF solver to use for resolving package installation
189 problems. This is either a predefined solver (this version of opam
190 supports builtin-mccs+lp(), builtin-mccs+glpk, aspcud, mccs,
191 aspcud-old, packup), or a custom command that should contain the
192 variables %{input}%, %{output}%, %{criteria}%, and optionally
193 %{timeout}%.
194
195 --strict
196 Fail whenever an error is found in a package definition or a
197 configuration file. The default is to continue silently if
198 possible.
199
200 --switch=SWITCH
201 Use SWITCH as the current compiler switch. This is equivalent to
202 setting $OPAMSWITCH to SWITCH.
203
204 --use-internal-solver, --no-aspcud
205 Disable any external solver, and use the built-in one (this
206 requires that opam has been compiled with a built-in solver).
207
208 -v, --verbose
209 Be more verbose. One -v shows all package commands, repeat to also
210 display commands called internally (e.g. tar, curl, patch etc.)
211 Repeating n times is equivalent to setting $OPAMVERBOSE to "n".
212
213 --version
214 Show version information.
215
216 -w, --working-dir
217 Whenever updating packages that are bound to a local,
218 version-controlled directory, update to the current working state
219 of their source instead of the last committed state, or the ref
220 they are pointing to. This only affects packages explicitly listed
221 on the command-line.
222
223 -y, --yes
224 Answer yes to all yes/no questions without prompting. This is
225 equivalent to setting $OPAMYES to "true".
226
228 Opam makes use of the environment variables listed here. Boolean
229 variables should be set to "0", "no", "false" or the empty string to
230 disable, "1", "yes" or "true" to enable.
231
232 OPAMCOLOR, when set to always or never, sets a default value for the
233 --color option.
234
235 OPAMCRITERIA specifies user preferences for dependency solving. The
236 default value depends on the solver version, use `config report` to
237 know the current setting. See also option --criteria
238
239 OPAMCURL can be used to select a given 'curl' program. See OPAMFETCH
240 for more options.
241
242 OPAMDEBUG see options `--debug' and `--debug-level'.
243
244 OPAMDOWNLOADJOBS sets the maximum number of simultaneous downloads.
245
246 OPAMERRLOGLEN sets the number of log lines printed when a sub-process
247 fails. 0 to print all.
248
249 OPAMEXTERNALSOLVER see option `--solver'.
250
251 OPAMFETCH specifies how to download files: either `wget', `curl' or a
252 custom command where variables %{url}%, %{out}%, %{retry}%,
253 %{compress}% and %{checksum}% will be replaced. Overrides the
254 'download-command' value from the main config file.
255
256 OPAMJOBS sets the maximum number of parallel workers to run.
257
258 OPAMJSON log json output to the given file (use character `%' to index
259 the files)
260
261 OPAMLOCK see option `--lock'.
262
263 OPAMNOAUTOUPGRADE disables automatic internal upgrade of repositories
264 in an earlier format to the current one, on 'update' or 'init'.
265
266 OPAMKEEPLOGS tells opam to not remove some temporary command logs and
267 some backups. This skips some finalisers and may also help to get more
268 reliable backtraces
269
270 OPAMLOCKRETRIES sets the number of tries after which OPAM gives up
271 acquiring its lock and fails. <= 0 means infinite wait.
272
273 OPAMNO answer no to any question asked.
274
275 OPAMNOASPCUD see option `--no-aspcud'.
276
277 OPAMNOSELFUPGRADE see option `--no-self-upgrade'.
278
279 OPAMPINKINDAUTO sets whether version control systems should be detected
280 when pinning to a local path. Enabled by default since 1.3.0.
281
282 OPAMREQUIRECHECKSUMS Enables option `--require-checksums' when
283 available (e.g. for `opam install`).
284
285 OPAMRETRY sets the number of tries before failing downloads.
286
287 OPAMROOT see option `--root'. This is automatically set by `opam env
288 --root=DIR --set-root'.
289
290 OPAMROOTISOK don't complain when running as root.
291
292 OPAMSAFE see option `--safe'
293
294 OPAMSKIPVERSIONCHECKS bypasses some version checks. Unsafe, for
295 compatibility testing only.
296
297 OPAMSOLVERTIMEOUT change the time allowance of the solver. Default is
298 60.0, set to 0 for unlimited. Note that all solvers may not support
299 this option.
300
301 OPAMSTATUSLINE display a dynamic status line showing what's currently
302 going on on the terminal. (one of one of `always', `never' or `auto')
303
304 OPAMSWITCH see option `--switch'. Automatically set by `opam env
305 --switch=SWITCH --set-switch'.
306
307 OPAMUPGRADECRITERIA specifies user preferences for dependency solving
308 when performing an upgrade. Overrides OPAMCRITERIA in upgrades if both
309 are set. See also option --criteria
310
311 OPAMUSEINTERNALSOLVER see option `--use-internal-solver'.
312
313 OPAMUTF8 use UTF8 characters in output (one of one of `always', `never'
314 or `auto'). By default `auto', which is determined from the locale).
315
316 OPAMUTF8MSGS use extended UTF8 characters (camels) in opam messages.
317 Implies OPAMUTF8. This is set by default on OSX only.
318
319 OPAMVAR_var overrides the contents of the variable var when
320 substituting `%{var}%` strings in `opam` files.
321
322 OPAMVAR_package_var overrides the contents of the variable package:var
323 when substituting `%{package:var}%` strings in `opam` files.
324
325 OPAMVERBOSE see option `--verbose'.
326
327 OPAMYES see option `--yes'.
328
330 As an exception to the following, the `exec' command returns 127 if the
331 command was not found or couldn't be executed, and the command's exit
332 value otherwise.
333
334 0 Success, or true for boolean queries.
335
336 1 False. Returned when a boolean return value is expected, e.g. when
337 running with --check, or for queries like opam lint.
338
339 2 Bad command-line arguments, or command-line arguments pointing to
340 an invalid context (e.g. file not following the expected format).
341
342 5 Not found. You requested something (package, version, repository,
343 etc.) that couldn't be found.
344
345 10 Aborted. The operation required confirmation, which wasn't given.
346
347 15 Could not acquire the locks required for the operation.
348
349 20 There is no solution to the user request. This can be caused by
350 asking to install two incompatible packages, for example.
351
352 30 Error in package definition, or other metadata files. Using
353 --strict raises this error more often.
354
355 31 Package script error. Some package operations were unsuccessful.
356 This may be an error in the packages or an incompatibility with
357 your system. This can be a partial error.
358
359 40 Sync error. Could not fetch some remotes from the network. This can
360 be a partial error.
361
362 50 Configuration error. Opam or system configuration doesn't allow
363 operation, and needs fixing.
364
365 60 Solver failure. The solver failed to return a sound answer. It can
366 be due to a broken external solver, or an error in solver
367 configuration.
368
369 99 Internal error. Something went wrong, likely due to a bug in opam
370 itself.
371
372 130 User interrupt. SIGINT was received, generally due to the user
373 pressing Ctrl-C.
374
376 See https://opam.ocaml.org/doc.
377
379 Vincent Bernardoff <vb@luminar.eu.org>
380 Raja Boujbel <raja.boujbel@ocamlpro.com>
381 Roberto Di Cosmo <roberto@dicosmo.org>
382 Thomas Gazagnaire <thomas@gazagnaire.org>
383 Louis Gesbert <louis.gesbert@ocamlpro.com>
384 Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
385 Anil Madhavapeddy <anil@recoil.org>
386 Guillem Rieu <guillem.rieu@ocamlpro.com>
387 Ralf Treinen <ralf.treinen@pps.jussieu.fr>
388 Frederic Tuong <tuong@users.gforge.inria.fr>
389
391 Check bug reports at https://github.com/ocaml/opam/issues.
392
393
394
395Opam 2.0.1 opam-config(1)