Scroll to navigation

dune(1) Dune Manual dune(1)


dune - composable build system for OCaml


dune COMMAND ...


Dune is a build system designed for OCaml projects only. It focuses on providing the user with a consistent experience and takes care of most of the low-level details of OCaml compilation. All you have to do is provide a description of your project and Dune will do the rest.

The scheme it implements is inspired from the one used inside Jane Street and adapted to the open source world. It has matured over a long time and is used daily by hundreds of developers, which means that it is highly tested and productive.


Build the given targets, or all installable targets if none are given.
Manage the shared artifacts cache
Clean the project.
Compute internal function.
Execute a command in a similar environment as if installation was performed.
Print out external libraries needed to build the given targets.
Format dune files
Additional Dune help
Initialize dune components
Install packages.
Print out libraries installed on the system.
Print the environment of a directory
Promote files from the last run
Dump internal rules.
Run tests.
Substitute watermarks in source files.
Uninstall packages.
Upgrade jbuilder projects to dune
Load library in utop


Show build information.
-f, --force
Force actions associated to aliases to be re-executed even if their dependencies haven't changed.
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto', `pager', `groff' or `plain'. With `auto', the format is `pager` or `plain' whenever the TERM env var is `dumb' or undefined.
--sandbox=VAL (absent DUNE_SANDBOX env)
Sandboxing mode to use by default. Some actions require a certain sandboxing mode, so they will ignore this setting. The allowed values are: none, symlink, copy.
Show version information.
-w, --watch
Instead of terminating build after completion, wait continuously for file changes.


These options are common to all commands.
Always show the full command lines of programs executed by dune
Automatically promote files. This is similar to running dune promote after the build.
--build-dir=FILE (absent DUNE_BUILD_DIR env)
Specified build directory. _build if unspecified
--cache=VAL (absent DUNE_CACHE env)
Activate binary cache
--cache-check-probability=VAL (absent=0. or DUNE_CACHE_CHECK_PROBABILITY env)
Probability cached rules are rerun to check for reproducibility
--cache-duplication=VAL (absent DUNE_CACHE_DUPLICATION env)
Binary cache duplication mode
--cache-transport=VAL (absent DUNE_CACHE_TRANSPORT env)
Binary cache protocol
Load this configuration file instead of the default one.
Always print exception backtraces.
In case of error, print the dependency path from the targets on the command line to the rule that failed.
Debug the findlib sub-system.
--default-target=TARGET (absent=@@default)
Set the default target that when none is specified to dune build.
Shell command to use to diff files. Use - to disable printing the diff.
--disable-promotion (absent DUNE_DISABLE_PROMOTION env)
Disable all promotion rules
Control the display mode of Dune. See dune-config(5) for more details.
Ignore rules with (mode promote), except ones with (only ...). The variable %{ignoring_promoted_rules} in dune files reflects whether this option was passed or not.
Run no more than JOBS commands simultaneously.
Do not buffer the output of commands executed by dune. By default dune buffers the output of subcommands, in order to prevent interleaving when multiple commands are executed in parallel. However, this can be an issue when debugging long running tests. With --no-buffer, commands have direct access to the terminal. Note that as a result their output won't be captured in the log file. You should use this option in conjunction with -j 1, to avoid interleaving. Additionally you should use --verbose as well, to make sure that commands are printed before they are being executed.
Do not load the configuration file
Suppress "Entering directory" messages
Ignore stanzas referring to a package that is not in PACKAGES. PACKAGES is a comma-separated list of package names. Note that this has the same effect as deleting the relevant stanzas from dune files. It is mostly meant for releases. During development, it is likely that what you want instead is to build a particular <package>.install target.
-p PACKAGES, --for-release-of-packages=PACKAGES
Shorthand for --root . --only-packages PACKAGE --ignore-promoted-rules --no-config --profile release. You must use this option in your <package>.opam files, in order to build only what's necessary when your project contains multiple packages as well as getting reproducible builds.
--profile=VAL (absent DUNE_PROFILE env)
Select the build profile, for instance dev orrelease. The default is dev.
Promote the generated <package>.install files to the source tree
Use this directory as workspace root instead of guessing it. Note that this option doesn't change the interpretation of targets given on the command line. It is only intended for scripts.
--store-orig-source-dir (absent DUNE_STORE_ORIG_SOURCE_DIR env)
Store original source location in dune-package metadata
Changes how the log of build results are displayed to the console between rebuilds while in --watch mode.
Output trace data in catapult format (compatible with chrome://tracing)
Same as --display verbose
--workspace=FILE (absent DUNE_WORKSPACE env)
Use this specific workspace file instead of looking it up.
-x VAL
Cross-compile using this toolchain.


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


These environment variables affect the execution of dune:
Specified build directory. _build if unspecified
Activate binary cache
Probability cached rules are rerun to check for reproducibility
Binary cache duplication mode
Binary cache protocol
Disable all promotion rules
Build profile. dev if unspecified or release if -p is set.
Sandboxing mode to use by default. (see --sandbox)
Store original source location in dune-package metadata
Use this specific workspace file instead of looking it up.


Check bug reports at
Dune 2.1.3