Command Line Interface¶
This is a short overview of the commands available in Dune. Reference
documentation for each command is available through dune COMMAND --help.
- dune build¶
Build the given targets, or the default ones.
- dune cache¶
Manage the shared cache of build artifacts.
- dune cache size¶
Query the size of the Dune cache.
- dune cache trim¶
Trim the Dune cache.
- dune clean¶
Clean the project.
- dune rocq¶
Command group related to Rocq.
- dune rocq top¶
Execute a Rocq toplevel with the local configuration.
- dune describe¶
Describe the workspace.
- dune describe aliases¶
Print aliases in a given directory. Works similarly to ls.
- dune describe env¶
Print the environment of a directory.
- dune describe external-lib-deps¶
Print out the external libraries needed to build the project. It’s an approximated set of libraries.
- dune describe installed-libraries¶
Print out the libraries installed on the system.
- dune describe opam-files¶
Print information about the opam files that have been discovered.
- dune describe package-entries¶
prints information about the entries per package.
- dune describe pp¶
Build a given file and print the preprocessed output.
- dune describe rules¶
Dump rules.
- dune describe targets¶
Print targets in a given directory. Works similarly to ls. The directory may be a path in the source tree, or a build-only directory under
_build/(such as_build/default/.lib.objs).
- dune describe workspace¶
Print a description of the workspace’s structure. If some directories are provided, then only those directories of the workspace are considered.
- dune diagnostics¶
Fetch and return errors from the current build.
- dune exec¶
Execute a command in a similar environment as if installation was performed.
Dune’s options and the executed program’s options share the same command line. If an argument to the program starts with
-, separate it from Dune’s options with--:$ dune exec ./tool.exe -- --program-option
Equivalently, put the separator before the whole command:
$ dune exec -- ./tool.exe --program-option
- dune fmt¶
Format source code.
- dune format-dune-file¶
Format
dunefiles.
- dune help¶
Additional Dune help.
- dune init¶
Command group for initializing Dune components.
- dune init executable¶
Initialize a binary executable.
- dune init library¶
Initialize an OCaml library.
- dune init project¶
Initialize a whole OCaml project.
- dune init test¶
Initialize a test harness.
- dune install¶
Install packages defined in workspace.
- dune installed-libraries¶
Print out libraries installed on the system.
- dune ocaml¶
Command group related to OCaml.
- dune ocaml dump-dot-merlin¶
Print Merlin configuration.
- dune ocaml merlin¶
Command group related to Merlin.
- dune ocaml merlin dump-config¶
Prints the entire content of the Merlin configuration for the given folder in a user friendly form.
- dune ocaml merlin start-session¶
Start a Merlin configuration server.
- dune ocaml ocaml-merlin¶
Start a Merlin configuration server.
- dune ocaml top¶
Print a list of toplevel directives for including directories and loading
.cmafiles.
- dune ocaml top-module¶
Print a list of toplevel directives for loading a module into the toplevel.
- dune ocaml utop¶
Load library in UTop.
- dune ocaml-merlin¶
Start a Merlin configuration server.
- dune printenv¶
Print the environment of a directory.
- dune promotion¶
Control how changes are propagated back to source code.
- dune promotion apply¶
Promote files from the last run.
- dune promotion diff¶
List promotions to be applied.
- dune promote¶
A command alias for
dune promotion apply.
- dune rpc¶
Dune’s RPC mechanism. Experimental.
- dune rules¶
Dump rules.
- dune runtest¶
Run tests.
- dune test¶
A command alias for
dune runtest.
- dune shutdown¶
Cancel and shutdown any builds in the current workspace.
- dune subst¶
Substitute watermarks in source files.
- dune tools¶
Added in version 3.17.
Command group for managing developer tools. See dune tools for details.
Warning
The
dune toolscommand group is experimental. Its subcommands, flags, and behavior may change in future versions of Dune without notice.- dune tools exec¶
Run a developer tool, automatically building it if needed.
- dune tools install¶
Install a developer tool without running it.
- dune tools which¶
Print the path to a developer tool’s executable.
- dune tools env¶
Print a command to add developer tool directories to your
PATH.
- dune top¶
Print a list of toplevel directives for including directories and loading
.cmafiles.
- dune uninstall¶
Uninstall packages defined in the workspace.
- dune upgrade¶
Upgrade projects across major Dune versions.
- dune utop¶
Load library in UTop.