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 coq

Command group related to Coq.

dune coq top

Execute a Coq 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.

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 fmt

Format source code.

dune format-dune-file

Format dune files.

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 .cma files.

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 top

Print a list of toplevel directives for including directories and loading .cma files.

dune uninstall

Uninstall packages defined in the workspace.

dune upgrade

Upgrade projects across major Dune versions.

dune utop

Load library in UTop.