DUNE(1)

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