DUNE-INIT(1) Dune Manual DUNE-INIT(1)

# [NAME](#NAME)

dune-init - Command group for initializing Dune components.

# [SYNOPSIS](#SYNOPSIS)

**dune init project NAME \[PATH] \[OPTION]...**

**dune init executable NAME \[PATH] \[OPTION]...**

**dune init library NAME \[PATH] \[OPTION]...**

**dune init test NAME \[PATH] \[OPTION]...**

**dune init start-file \[PATH]**

# [DESCRIPTION](#DESCRIPTION)

**dune init COMPONENT NAME \[PATH] \[OPTION]...** initializes a new dune configuration for a component of the kind specified by the subcommand **COMPONENT**, named **NAME**, with fields determined by the supplied **OPTION**s.

Run a subcommand with **--help** for for details on it's supported arguments

If the optional **PATH** is provided, it must be a path to a directory, and the component will be created there. Otherwise, it is created in a child of the current working directory, called **NAME**. To initialize a component in the current working directory, use \`.\` as the **PATH**.

Any prefix of a **COMMAND**'s name can be supplied in place of full name (as illustrated in the synopsis).

For more details, see https://dune.readthedocs.io/en/stable/usage.html#initializing-components

# [COMMANDS](#COMMANDS)

[**executable** \[*OPTION*\]… *NAME* \[*PATH*\]](#executable)

A binary executable.

[**library** \[*OPTION*\]… *NAME* \[*PATH*\]](#library)

An OCaml library.

[**project** \[*OPTION*\]… *NAME* \[*PATH*\]](#project)

A project is a predefined composition of components arranged in a standard directory structure. The kind of project initialized is determined by the value of the **--kind** flag and defaults to an executable project, composed of a library, an executable, and a test component.

[**start-file** \[*OPTION*\]… \[*PATH*\]](#start)

Write the standard start/dune file.

[**test** \[*OPTION*\]… *NAME* \[*PATH*\]](#test)

A test harness. (For inline tests, use the **--inline-tests** flag along with the other component kinds.)

# [COMMON OPTIONS](#COMMON_OPTIONS)

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

# [EXIT STATUS](#EXIT_STATUS)

**dune init** exits with:

0

on success.

1

if an error happened.

130

if it was interrupted by a signal.

# [EXAMPLES](#EXAMPLES)

1\.

Generate a project skeleton for an executable named \`myproj' in a new directory named \`myproj', depending on the bos library and using inline tests along with ppx\_inline\_test:

```


      dune init project myproj --libs bos --ppx ppx_inline_test --inline-tests
```

2\.

Configure an executable component named \`myexe' in a dune file in the current directory:

```


      dune init executable myexe
```

3\.

Configure a library component named \`mylib' in a dune file in the ./src directory depending on the core and cmdliner libraries, the ppx\_let and ppx\_inline\_test preprocessors, and declared as using inline tests:

```


      dune init library mylib src --libs core,cmdliner --ppx ppx_let,ppx_inline_test --inline-tests
```

4\.

Configure a test component named \`mytest' in a dune file in the ./test directory that depends on \`mylib':

```


      dune init test mytest test --libs mylib
```

5\.

Write the standard \`start/dune\` helper file:

```


      dune init start-file
```

# [SEE ALSO](#SEE_ALSO)

[dune(1)](/man/os/ocaml-dune/dune.1)

Dune 3.24.2

---

Document: dune-init(1) from ocaml-dune 3.24.2-r2 (Chainguard OS)
Source: https://github.com/ocaml/dune
