1dune-exec(1)                      Dune Manual                     dune-exec(1)
2
3
4

NAME

6       dune-exec - Execute a command in a similar environment as if
7       installation was performed.
8

SYNOPSIS

10       dune exec [OPTION]... PROG [ARGS]...
11

DESCRIPTION

13       dune exec -- COMMAND should behave in the same way as if you do:
14
15         $ dune install
16         $ COMMAND
17
18       In particular if you run dune exec ocaml, you will have access to the
19       libraries defined in the workspace using your usual directives
20       (#require for instance)
21
22       When a leading / is present in the command (absolute path), then the
23       path is interpreted as an absolute path
24
25       When a / is present at any other position (relative path), then the
26       path is interpreted as relative to the build context + current working
27       directory (or the value of --root when ran outside of the project root)
28

OPTIONS

30       --build-info
31           Show build information.
32
33       --context=CONTEXT (absent=default)
34           Run the command in this build context.
35
36       -f, --force
37           Force actions associated to aliases to be re-executed even if their
38           dependencies haven't changed.
39
40       --help[=FMT] (default=auto)
41           Show this help in format FMT. The value FMT must be one of `auto',
42           `pager', `groff' or `plain'. With `auto', the format is `pager` or
43           `plain' whenever the TERM env var is `dumb' or undefined.
44
45       --no-build
46           don't rebuild target before executing
47
48       --sandbox=VAL (absent DUNE_SANDBOX env)
49           Sandboxing mode to use by default. Some actions require a certain
50           sandboxing mode, so they will ignore this setting. The allowed
51           values are: none, symlink, copy.
52
53       --version
54           Show version information.
55
56       -w, --watch
57           Instead of terminating build after completion, wait continuously
58           for file changes.
59

COMMON OPTIONS

61       These options are common to all commands.
62
63       --always-show-command-line
64           Always show the full command lines of programs executed by dune
65
66       --auto-promote
67           Automatically promote files. This is similar to running dune
68           promote after the build.
69
70       --build-dir=FILE (absent DUNE_BUILD_DIR env)
71           Specified build directory. _build if unspecified
72
73       --cache=VAL (absent DUNE_CACHE env)
74           Activate binary cache (either `disabled' or `enabled'). Default is
75           `disabled'.
76
77       --cache-check-probability=VAL (absent=0. or
78       DUNE_CACHE_CHECK_PROBABILITY env)
79           Probability cached rules are rerun to check for reproducibility
80
81       --cache-duplication=VAL (absent DUNE_CACHE_DUPLICATION env)
82           Binary cache duplication mode
83
84       --cache-transport=VAL (absent DUNE_CACHE_TRANSPORT env)
85           Binary cache protocol
86
87       --config-file=FILE
88           Load this configuration file instead of the default one.
89
90       --debug-backtraces
91           Always print exception backtraces.
92
93       --debug-dependency-path
94           In case of error, print the dependency path from the targets on the
95           command line to the rule that failed.
96
97       --debug-findlib
98           Debug the findlib sub-system.
99
100       --default-target=TARGET (absent=@@default)
101           Set the default target that when none is specified to dune build.
102
103       --diff-command=VAL
104           Shell command to use to diff files. Use - to disable printing the
105           diff.
106
107       --disable-promotion (absent DUNE_DISABLE_PROMOTION env)
108           Disable all promotion rules
109
110       --display=MODE
111           Control the display mode of Dune. See dune-config(5) for more
112           details.
113
114       --ignore-promoted-rules
115           Ignore rules with (mode promote), except ones with (only ...). The
116           variable %{ignoring_promoted_rules} in dune files reflects whether
117           this option was passed or not.
118
119       -j JOBS
120           Run no more than JOBS commands simultaneously.
121
122       --no-buffer
123           Do not buffer the output of commands executed by dune. By default
124           dune buffers the output of subcommands, in order to prevent
125           interleaving when multiple commands are executed in parallel.
126           However, this can be an issue when debugging long running tests.
127           With --no-buffer, commands have direct access to the terminal. Note
128           that as a result their output won't be captured in the log file.
129           You should use this option in conjunction with -j 1, to avoid
130           interleaving. Additionally you should use --verbose as well, to
131           make sure that commands are printed before they are being executed.
132
133       --no-config
134           Do not load the configuration file
135
136       --no-print-directory
137           Suppress "Entering directory" messages
138
139       --only-packages=PACKAGES
140           Ignore stanzas referring to a package that is not in PACKAGES.
141           PACKAGES is a comma-separated list of package names. Note that this
142           has the same effect as deleting the relevant stanzas from dune
143           files. It is mostly meant for releases. During development, it is
144           likely that what you want instead is to build a particular
145           <package>.install target.
146
147       -p PACKAGES, --for-release-of-packages=PACKAGES
148           Shorthand for --release --only-packages PACKAGE. You must use this
149           option in your <package>.opam files, in order to build only what's
150           necessary when your project contains multiple packages as well as
151           getting reproducible builds.
152
153       --profile=VAL (absent DUNE_PROFILE env)
154           Select the build profile, for instance dev or release. The default
155           is dev.
156
157       --promote-install-files
158           Promote the generated <package>.install files to the source tree
159
160       --release
161           Put dune into a reproducible release mode. This is in fact a
162           shorthand for --root . --ignore-promoted-rules --no-config
163           --profile release --always-show-command-line
164           --promote-install-files --default-target @install. You should use
165           this option for release builds. For instance, you must use this
166           option in your <package>.opam files. Except if you already use -p,
167           as -p implies this option.
168
169       --root=DIR
170           Use this directory as workspace root instead of guessing it. Note
171           that this option doesn't change the interpretation of targets given
172           on the command line. It is only intended for scripts.
173
174       --store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
175           Store original source location in dune-package metadata
176
177       --terminal-persistence=MODE
178            Changes how the log of build results are displayed to the console
179           between rebuilds while in --watch mode.
180
181       --trace-file=FILE
182           Output trace data in catapult format (compatible with
183           chrome://tracing)
184
185       --verbose
186           Same as --display verbose
187
188       --workspace=FILE (absent DUNE_WORKSPACE env)
189           Use this specific workspace file instead of looking it up.
190
191       -x VAL
192           Cross-compile using this toolchain.
193

MORE HELP

195       Use `dune COMMAND --help' for help on a single command.
196

ENVIRONMENT

198       These environment variables affect the execution of exec:
199
200       DUNE_BUILD_DIR
201           Specified build directory. _build if unspecified
202
203       DUNE_CACHE
204           Activate binary cache (either `disabled' or `enabled'). Default is
205           `disabled'.
206
207       DUNE_CACHE_CHECK_PROBABILITY
208           Probability cached rules are rerun to check for reproducibility
209
210       DUNE_CACHE_DUPLICATION
211           Binary cache duplication mode
212
213       DUNE_CACHE_TRANSPORT
214           Binary cache protocol
215
216       DUNE_DISABLE_PROMOTION
217           Disable all promotion rules
218
219       DUNE_PROFILE
220           Build profile. dev if unspecified or release if -p is set.
221
222       DUNE_SANDBOX
223           Sandboxing mode to use by default. (see --sandbox)
224
225       DUNE_STORE_ORIG_SOURCE_DIR
226           Store original source location in dune-package metadata
227
228       DUNE_WORKSPACE
229           Use this specific workspace file instead of looking it up.
230

BUGS

232       Check bug reports at https://github.com/ocaml/dune/issues
233

EXAMPLES

235       1.  Run the executable named `my_exec':
236
237             dune exec my_exec
238
239       2.  Run the executable defined in `foo.ml' with the argument `arg':
240
241             dune exec ./foo.exe -- arg
242
243
244
245Dune n/a                                                          dune-exec(1)
Impressum