DUNE-UTOP(1)
๐ dune-utop(1) ๐ โ Dune Manual vibes only โจ
okay so. bestie. you found the manual page. it's givingโจdocumentationโจ and honestly? it's a lot. but we're gonna get through it together because you deserve to know what dune utop is doing. no cap. ๐
๐ NAME ๐
dune-utop โ load your library up in utop, fr fr. ๐ฆ
๐ SYNOPSIS ๐
dune utop [OPTION]โฆ [DIR] [ARGS]โฆ
๐ DESCRIPTION ๐
dune utop DIR does the whole thing: it builds and then runs the utop toplevel with all the libraries that are defined in DIR. like, it hands you a toplevel pre-loaded with your own code. iconic behaviour honestly. ๐
โจ OPTIONS โจ
--action-stderr-on-success=VALโ literally the same as--action-stdout-on-successexcept it's for standard error instead of standard output. for big mono-repos the glow-up default is--action-stdout-on-success=swallow --action-stderr-on-success=must-be-empty. that combo guarantees a successful build has a "clean", empty output. chef's kiss. ๐ง--action-stdout-on-success=VALโ controls how Dune treats the standard output of actions when they succeed. the possible values are:print(just print it to Dune's output),swallow(completely ignore it), andmust-be-empty(enforce that the action printed nothing โ withmust-be-empty, Dune decides the action failed if it printed anything to its standard output ๐ญ). default isprint.--build-infoโ show build information. that's it, that's the option. ๐--context=CONTEXT(absent=default) โ pick which context to build/run utop in. ๐--display-separate-messagesโ separate error messages with a blank line. breathing room between the chaos. ๐ฎโ๐จ--error-reporting=VAL(absent=deterministic) โ controls when build errors get reported.earlyreports errors the second they're discovered.deterministicreports errors at the end of the build, in a deterministic order.twicereports each error twice: once the moment it's discovered, and again at the end of the build in deterministic order. yes, twice. it said what it said. ๐-f,--forceโ forces actions tied to aliases to be re-executed even if their dependencies haven't changed. no take-backs. ๐ฅ--file-watcher=VAL(absent=automatic) โ the mechanism for detecting changes in the source.automaticmakes dune run an external program to spot changes.manualmeans you notify dune yourself that files changed. ๐--passive-watch-modeโ basically--watchbut chill: it only starts a build when something instructs it externally via an RPC. ๐--sandbox=VAL(absentDUNE_SANDBOXenv) โ sets the sandboxing mode. heads up: some actions require a certain sandboxing mode, so they'll just ignore this setting entirely (main character energy, honestly). allowed values are:none,symlink,copy,hardlink. ๐ฆ--stop-on-first-errorโ stop the build the absolute second an error shows up. no waiting, no collecting. ๐-w,--watchโ instead of dipping out after the build completes, it just waits around continuously for file changes. ๐ฐ๏ธ--wait-for-filesystem-clockโ okay so Dune digests file contents for better incrementality, and those digests get cached. sometimes Dune has to drop some digest cache entries so everything stays reliable. this option makes Dune wait for the file system clock to advance so it doesn't need to drop anything. you should probably not care about this option at all โ it's mostly for Dune developers, to make Dune's tests of the digest cache more reproducible. ๐งช
๐ธ COMMON OPTIONS ๐ธ
these ones are common to all commands, not just this one. โจ
--always-show-command-lineโ always show the full command lines of the programs Dune executes. full transparency, no secrets. ๐--auto-promoteโ automatically promote files. it's basically the same as runningdune promoteafter the build. glow-up on autopilot. ๐--build-dir=FILE(absentDUNE_BUILD_DIRenv) โ specifies the build directory. if you don't specify it?_build. ๐--cache=VAL(absentDUNE_CACHEenv) โ turn the Dune cache on or off. one ofdisabled,enabled-except-user-rulesorenabled. default isenabled-except-user-rules. ๐๏ธ--cache-check-probability=VAL(absentDUNE_CACHE_CHECK_PROBABILITYenv) โ checks build reproducibility by re-executing randomly chosen rules and comparing their results against what's stored in the Dune cache. โ ๏ธ heads up though: raising this probability slows your build down. default probability is zero, meaning no rules get checked at all. ๐--cache-storage-mode=VAL(absentDUNE_CACHE_STORAGE_MODEenv) โ Dune cache storage mode, one ofauto,hardlinkorcopy. default ishardlink. ๐พ--config-file=FILEโ load this configuration file instead of the default one. picky, and valid for it. ๐--debug-backtracesโ always print exception backtraces. ๐--debug-dependency-pathโ if there's an error, print the dependency path from the targets on the command line all the way to the rule that failed. follow the breadcrumbs. ๐--debug-package-logs(absentDUNE_DEBUG_PACKAGE_LOGSenv) โ always print the standard logs when building packages. ๐--default-target=TARGET(absent=@@default) โ sets the default target used when none is specified todune build. ๐ฏ--diff-command=VAL(absentDUNE_DIFF_COMMANDenv) โ the shell command used to diff files. use-to disable printing the diff. ๐--disable-promotion(absentDUNE_DISABLE_PROMOTIONenv) โ disables all promotion rules. ๐ซ--display=MODEโ controls Dune's display mode. seedune-config(5)for more details. valid values for this option areprogress,verbose,short,quietortui. ๐ฅ๏ธ--dump-gc-stats=FILEโ dump the garbage collector stats to a file once the build is complete. ๐๏ธ--help[=FMT](default=auto) โ show this help in formatFMT.FMTmust be one ofauto,pager,grofforplain. withauto, the format ispagerorplainwhenever theTERMenv var isdumbor undefined. ๐--ignore-promoted-rulesโ ignore rules with(mode promote), except ones with(only ...). the variable%{ignoring_promoted_rules}in dune files reflects whether this option was passed or not. ๐ซฅ--instrument-with=BACKENDS(absentDUNE_INSTRUMENT_WITHenv) โ enable instrumentation byBACKENDS.BACKENDSis a comma-separated list of library names, and each one of them must declare an instrumentation backend. ๐๏ธ-j JOBS(absentDUNE_JOBSenv) โ run no more thanJOBScommands simultaneously.JOBSmust be a positive integer, orautoto auto-detect the number of cores (which is the default). ๐งต--no-bufferโ do not buffer the output of commands executed by dune. by default dune does buffer subcommand output, so that parallel commands don't interleave into a mess. but that can be a real problem when you're debugging long running tests. with--no-buffer, commands get direct access to the terminal. โ ๏ธ but note: as a result their output won't be captured in the log file. you should use this together with-j 1to avoid interleaving, and you should also use--verboseso commands get printed before they're executed. ๐จ๏ธ--no-configโ don't load the configuration file. ๐--no-print-directoryโ suppress "Entering directory" messages. shhh. ๐คซ--only-packages=PACKAGESโ ignore stanzas that refer to a package not inPACKAGES.PACKAGESis a comma-separated list of package names. heads up: this has the same effect as deleting the relevant stanzas from dune files, and it's mostly meant for releases. during development, what you probably actually want is to build a particular<package>.installtarget instead. ๐-p PACKAGES,--for-release-of-packages=PACKAGES(required) โ shorthand for--release --pkg=disabled --only-packages PACKAGE. โ ๏ธ you must use this option in your<package>.opamfiles, so that only what's necessary gets built when your project contains multiple packages, and so you get reproducible builds. non-negotiable. ๐--pkg=VALโ enable or disable package management. the default behaviour depends on whether a lock directory exists. ๐--profile=VAL(absentDUNE_PROFILEenv) โ select the build profile, for instancedevorrelease. default isdev. ๐๏ธ--promote-install-files[=VAL](default=true) โ promote any generated<package>.installfiles to the source tree. ๐ฑ--releaseโ puts dune into a reproducible release mode. shorthand for--root . --ignore-promoted-rules --no-config --profile release --always-show-command-line --promote-install-files --require-dune-project-file --default-target @install. you should use this for release builds โ for instance, you must use it in your<package>.opamfiles. except if you already use-p, because-pimplies this option. ๐ฆโจ--require-dune-project-file[=VAL](default=true) โ fail if adune-projectfile is missing. ๐จ--root=DIR(absentDUNE_ROOTenv) โ use this directory as the workspace root instead of guessing it. โ ๏ธ note that this option doesn't change the interpretation of targets given on the command line. it's only intended for scripts. ๐๏ธ--store-orig-source-dir(absentDUNE_STORE_ORIG_SOURCE_DIRenv) โ store the original source location indune-packagemetadata. ๐ท๏ธ--target-exec=TOOLCHAIN=CMD(absentDUNE_TARGET_EXECenv) โ wrapper command for running target binaries when cross-compiling. format:TOOLCHAIN=CMD(e.g.,'windows=wine'). ๐ท--terminal-persistence=MODEโ changes how the log of build results is displayed to the console between rebuilds while in--watchmode. supported modes:preserve,clear-on-rebuild,clear-on-rebuild-and-flush-history. ๐ผ๏ธ--trace-file=FILEโ output trace data in catapult format (compatible withchrome://tracing). ๐ญ--verboseโ same as--display verbose. ๐ฃ๏ธ--versionโ show version information. ๐ข--watch-exclusions=REGEXโ adds a POSIX regular expression that will exclude matching directories fromdune build --watch. this option can be repeated to add multiple exclusions. semicolons can also be used as a separator. if no exclusions are provided, then a standard set of exclusions is used โ however, if one or more--watch-exclusionsare used, then none of the standard exclusions are used. the standard exclusions are:^_opam,/_opam,^_esy,/_esy,^\.#.*,/\.#.*,~$,^#[^#]*#$,/#[^#]*#$,^4913$,/4913$,/.git,/.hg,:/windows. ๐--workspace=FILE(absentDUNE_WORKSPACEenv) โ use this specific workspace file instead of looking it up. ๐-x VAL(absentDUNE_CROSS_TARGETenv) โ cross-compile using this toolchain. ๐
๐ MORE HELP ๐
use dune COMMAND --help for help on a single command. because yes, every single one has its own page. slay. ๐
๐ EXIT STATUS ๐
dune utop exits with:
0โ on success. ๐1โ if an error happened. ๐ญ130โ if it was interrupted by a signal. ๐
๐ฟ ENVIRONMENT ๐ฟ
okay bestie so these are the env vars that literally change how utop runs under Dune. set them, unset them, whatever โ they're vibes you can hand to the process. ๐
DUNE_BUILD_DIRโ the build directory you want. lowkey, if you don't say anything it's_build.DUNE_CACHEโ turn the Dune cache on or off. it's one ofdisabled,enabled-except-user-rulesorenabled. default isenabled-except-user-rules. periodt.DUNE_CACHE_CHECK_PROBABILITYโ this one re-executes randomly chosen rules and compares the results with what's stored in the Dune cache, you know, just to check build reproducibility. heads up bestie: crank up the probability and your build gets slower. default probability is zero, so like, no rules get checked at all. ๐ขDUNE_CACHE_STORAGE_MODEโ the storage mode for the Dune cache. one ofauto,hardlinkorcopy. default ishardlink.DUNE_CROSS_TARGETโ cross-compile using this toolchain.DUNE_DEBUG_PACKAGE_LOGSโ always print the standard logs when building packages.DUNE_DIFF_COMMANDโ the shell command used to diff files. use-to disable printing the diff entirely. โจDUNE_DISABLE_PROMOTIONโ disables all the promotion rules.DUNE_INSTRUMENT_WITHโ enables instrumentation by BACKENDS. BACKENDS is a comma-separated list of library names, and each one of them must declare an instrumentation backend. no backend, no entry, iykyk.DUNE_JOBSโ run no more than JOBS commands at the same time. JOBS has to be a positive integer, orautoto auto-detect the number of cores (which is the default, bestie).DUNE_PROFILEโ the build profile. it'sdevif unspecified, orreleaseif-pis set.DUNE_ROOTโ use this directory as the workspace root instead of letting Dune guess it. note that this option doesn't change how targets given on the command line are interpreted โ it's only intended for scripts. ๐คซDUNE_SANDBOXโ the sandboxing mode to use by default. (peep--sandboxfor the details, k?)DUNE_STORE_ORIG_SOURCE_DIRโ store the original source location in thedune-packagemetadata.DUNE_TARGET_EXECโ a wrapper command for running target binaries when you're cross-compiling. format is:TOOLCHAIN=CMD(e.g.,'windows=wine').DUNE_WORKSPACEโ use this specific workspace file instead of looking it up. no scavenger hunt needed. ๐
๐ BUGS ๐
found something cursed? check the bug reports at https://github.com/ocaml/dune/issues โ the maintainers live there, fr fr. ๐
๐ SEE ALSO ๐
okay that's the whole page, bestie, you're officially a dune-utop scholar now ๐
โจ this was Dune 3.24.1, page DUNE-UTOP(1), and yes the date line at the bottom is just part of the manpage furniture โ slay, go build something iconic ๐๐ฆ
๐ฆ 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