Reference

dune(1)

composable build system for OCaml

NAME

dune - composable build system for OCaml

SYNOPSIS

dune build [--watch]

dune runtest [--watch]

dune exec NAME

dune utop [DIR]

dune install

dune init project NAME [PATH] [--libs=l1,l2 --ppx=p1,p2 --inline-tests]

DESCRIPTION

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.

COMMAND ALIASES

printenv [OPTION]… [PATH]

An alias for env.

promote [--build-info] [--file] [OPTION]… [FILE]…

An alias for promotion apply.

test [OPTION]… [TEST]…

An alias for runtest.

COMMANDS

build [OPTION]… [TARGET]…

Build the given targets, or the default ones if none are given.

cache COMMAND …

Manage Dune's shared cache of build artifacts.

clean [OPTION]… [PATH]…

Clean the project.

describe [COMMAND] …

Describe the workspace.

diagnostics [OPTION]…

Fetch and return errors from the current build.

exec [OPTION]… PROG [ARGS]…

Execute a command in a similar environment as if installation was performed.

external-lib-deps [OPTION]… [TARGET]…

Moved to dune describe external-lib-deps.

fmt [OPTION]…

Format source code.

format-dune-file [OPTION]… [FILE]

Format dune files.

help [--build-info] [--man-format=FMT] [OPTION]… [TOPIC]

Additional Dune help.

init COMMAND …

Command group for initializing Dune components.

install [OPTION]… [PACKAGE]…

Install packages defined in the workspace.

installed-libraries [OPTION]…

Print out libraries installed on the system.

internal COMMAND …
monitor [OPTION]…

Connect to a Dune RPC server and monitor it.

ocaml COMMAND …

Command group related to OCaml.

ocaml-merlin [OPTION]…

Start a merlin configuration server.

package COMMAND …

Experimental package management

pkg COMMAND …

Experimental package management

promotion COMMAND …

Control how changes are propagated back to source code.

rocq COMMAND …

Command group related to Rocq.

rpc COMMAND …

Dune's RPC mechanism. Experimental.

rules [OPTION]… [TARGET]…

Dump rules.

runtest [OPTION]… [TEST]…

Run tests.

show COMMAND …

Command group for showing information about the workspace

shutdown [OPTION]…

Cancel and shutdown any builds in the current workspace.

subst [--build-info] [OPTION]…

Substitute watermarks in source files.

tools COMMAND …

Command group for wrapped tools.

top [OPTION]… [DIR]

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

trace COMMAND …

Commands to view dune's event trace

uninstall [OPTION]… [PACKAGE]…

Uninstall packages defined in the workspace.

upgrade [OPTION]…

Upgrade projects across major Dune versions.

utop [OPTION]… [DIR] [ARGS]…

Load library in utop.

COMMON OPTIONS

These options are common to all commands.

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

--version

Show version information.

MORE HELP

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

EXIT STATUS

dune exits with:

0

on success.

1

if an error happened.

130

if it was interrupted by a signal.

ENVIRONMENT

These environment variables affect the execution of dune:

CLICOLOR

If different than 0, ANSI colors are supported and should be used when the program isn't piped. If equal to 0, don't output ANSI color escape codes

CLICOLOR_FORCE

If different than 0, ANSI colors should be enabled no matter what.

DUNE_CACHE_ROOT

If set, determines the location of all the different caches used by dune.

BUGS

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

EXAMPLES

1.

Initialise a new project named `foo':

      dune init project foo

2.

Build all targets in the current source tree:

      dune build

3.

Run the executable named `bar':

      dune exec bar

4.

Run all tests in the current source tree:

      dune runtest

5.

Install all components defined in the project:

      dune install

6.

Remove all build artefacts:

      dune clean

History

--version since Debian 10 (Buster).

--always-show-command-line until Debian 12 (Bookworm); --auto-promote until Debian 12 (Bookworm); --build-info until Debian 12 (Bookworm); --config-file until Debian 12 (Bookworm); --debug-artifact-substitution until Debian 12 (Bookworm); --debug-backtraces until Debian 12 (Bookworm); --debug-dependency-path until Debian 12 (Bookworm); --debug-findlib until Debian 12 (Bookworm); --default-target until Debian 10 (Buster); --dev until Debian 10 (Buster); --diff-command until Debian 12 (Bookworm); --display until Debian 12 (Bookworm); --for-release-of-packages until Debian 11 (Bullseye); --force until Debian 12 (Bookworm); --ignore-promoted-rules until Debian 12 (Bookworm); --no-buffer until Debian 12 (Bookworm); --no-config until Debian 12 (Bookworm); --no-print-directory until Debian 12 (Bookworm); --only-packages until Debian 12 (Bookworm); --profile until Debian 10 (Buster); --promote-install-files until Debian 11 (Bullseye); --release until Debian 12 (Bookworm); --root until Debian 12 (Bookworm); --stats until Debian 10 (Buster); --terminal-persistence until Debian 12 (Bookworm); --trace-file until Debian 12 (Bookworm); --verbose until Debian 12 (Bookworm); --watch until Debian 12 (Bookworm); --workspace until Debian 10 (Buster); -f until Debian 12 (Bookworm); -j until Debian 12 (Bookworm); -p until Debian 11 (Bullseye); -w until Debian 12 (Bookworm); -x until Debian 12 (Bookworm).