DUNE(1)
π DUNE(1) β the Dune Manual, but make it a group chat π
okay bestie, sit down, hydrate, because we're about to talk about the single most iconic build system in the OCaml cinematic universe. it's dune, it's giving composable build system for OCaml, and it's literally about to carry your whole project on its back. π
β¨ NAME β¨
dune β a 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 π¦
so. Dune is a build system designed for OCaml projects only. it's not trying to be everything to everyone, it's just trying to be your everything. it focuses on giving you a consistent experience and it handles basically all the low-level details of OCaml compilation that you do NOT want to be thinking about at 2am. all you have to do is describe your project, and Dune does the rest. that's it. that's the deal. no cap. π₯
the scheme it implements is inspired by the one used inside Jane Street, adapted for the open source world. it has matured over a long time and is used daily by hundreds of developers, which means it is highly tested and productive. it ate, honestly. π
π« COMMAND ALIASES π«
these are the little shortcut besties. same energy, shorter name.
printenv [OPTION]β¦ [PATH]β an alias forenv.promote [--build-info] [--file] [OPTION]β¦ [FILE]β¦β an alias forpromotion apply.test [OPTION]β¦ [TEST]β¦β an alias forruntest.
π COMMANDS π
the whole squad, in order, no one left behind:
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 todune describe external-lib-deps. (it moved, we don't gatekeep, but also we're telling you where it went π)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 β¦β (yes it's just there, being mysterious, minding its business π«Ά)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 managementpkg COMMAND β¦β experimental package managementpromotion 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 workspaceshutdown [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 traceuninstall [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 ones are common to all commands. every single one. they're the universal besties. β¨
--help[=FMT](default=auto) β show this help in formatFMT. the valueFMTmust be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined.--versionβ show version information.
β MORE HELP β
use dune COMMAND --help for help on a single command. iykyk. π
π EXIT STATUS π
dune exits with:
0β on success. we love a win. π1β if an error happened. it's giving not our day. π130β if it was interrupted by a signal.
π§ ENVIRONMENT π§
these environment variables affect the execution of dune:
CLICOLORβ if different than0, ANSI colors are supported and should be used when the program isn't piped. if equal to0, don't output ANSI color escape codesCLICOLOR_FORCEβ if different than0, 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 β the devs are literally right there, go tell them, they're nice about it fr fr.
πΈ EXAMPLES πΈ
some little situations to manifest β¨
- Initialise a new project named
foo:
dune init project foo
- Build all targets in the current source tree:
dune build
- Run the executable named
bar:
dune exec bar
- Run all tests in the current source tree:
dune runtest
- Install all components defined in the project:
dune install
- Remove all build artefacts:
dune clean
π that's the whole page bestie. every flag, every command, every env var, nothing skipped, nothing guessed. go build something iconic. periodt. π
okay and lastly, the little signature at the bottom of the original: this is from Dune 3.24.1, and yes, this whole thing is the DUNE(1) page. take care of her, she's doing her best. π«Άβ¨
π¦ where this page comes from
- ubuntu stonking: ocaml-dune 3.24.1-4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms