dune - Man Page
composable build system for OCaml
Examples (TL;DR)
- Build all targets:
dune build
- Clean up the workspace:
dune clean
- Run all tests:
dune runtest
- Start the utop REPL with compiled modules automatically loaded into it, to remove the need to load them by hand:
dune utop
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 [OPTION]… [FILE]…
An alias for promotion apply.
- test [OPTION]… [DIR]…
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]…
Clean the project.
- coq COMMAND …
Command group related to Coq.
- 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 [--dune-version=VERSION] [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.
- pkg COMMAND …
Experimental package management
- promotion COMMAND …
Control how changes are propagated back to source code.
- rpc COMMAND …
Dune's RPC mechanism. Experimental.
- rules [OPTION]… [TARGET]…
Dump rules.
- runtest [OPTION]… [DIR]…
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.
- top [OPTION]… [DIR]
Print a list of toplevel directives for including directories and loading cma files.
- 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 the machine-global shared cache.
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
Referenced By
dune-build(1), dune-cache(1), dune-clean(1), dune-coq(1), dune-describe(1), dune-diagnostics(1), dune-exec(1), dune-external-lib-deps(1), dune-fmt(1), dune-format-dune-file(1), dune-help(1), dune-init(1), dune-install(1), dune-installed-libraries(1), dune-internal(1), dune-monitor(1), dune-ocaml(1), dune-ocaml-merlin(1), dune-pkg(1), dune-printenv(1), dune-promote(1), dune-promotion(1), dune-rpc(1), dune-rules(1), dune-runtest(1), dune-show(1), dune-shutdown(1), dune-subst(1), dune-test(1), dune-top(1), dune-uninstall(1), dune-upgrade(1), dune-utop(1).