Setting up a new OCaml environment in 2026 is not yet a fluid experience

Well, dune is just exploring directories and looking for dune files with stanzas. So, it is very easy, after for example dune init proj you can just use (in Unix/Linux) mv lib src to rename the directory, and mv bin mycli (for example). Remember that the only key point are the dune files on each directory, not the name of the directory. So when you do dune build or dune exec is not important the folder names but the dune files.

The useful point when using dune init proj is to check how is the dune file inside the bin/ directory to understand the stanzas to create binary files, and in lib check the dune file to see the basic stanzas for libraries, or also the test/dune to review the stanzas for testing. By stanzas I just meant the commands (using s-expressions) written in the dune files. This would give you an idea about basic stuff, then here:

In this link you can see more advanced ideas for your stanzas, and more advanced stuff (for example a kind of meta-programming via ppx can be specified easily). You can explore C-stubs, or WASM, or Javascript compilation using dune. As I said, it is a powerful tool, from my point of view.

Again, to my knowledge the names of the folders are totally arbitrary, dune allows you to use whatever names you want. Also here, at the end you will see a list of tools on top of dune if you want to replicate, for example, the cargo style. But honestly my recommendation is to try to learn dune itself.

I wish you all the best, and great that you returned to OCaml. I hope you will enjoy.

PD: In dune there are specific stanzas that may need to be updated in case you rename directories, but this only happened for advanced features, when you want to specify data-files for your project, or when you want to define external files to be loaded by your code. But usually you introduce these features when you already have decided the names of the directories of your project, for example, if you have a directory data for data-files etc…

1 Like