TL;DR : quite messy experience with OCaml tooling installation ; is there a straightforward way to setup OCaml with all its tools ?
Back again to Ocaml, I first tried to quickly setup tools on my Win11 laptop.
It was messy with WSL with a strange message (“The file (wsl.exe ?) doesn’t exist”). No taste for digging in Win stuff…
And I didn’t want to use Docker nor Virtualbox or VMware workstation.
So I used my good old PC with Debian.
No problem to install opam and the packages I need.
I installed VS code and the extension VScode OCaml platform. And also installed ocaml-lsp-server and ocamlformat with opam.
Of course, I had a look at the Get started page and especially to Configuring Your Editor · OCaml Documentation
In Your First OCaml Program · OCaml Documentation I found a ugly
$ opam exec -- dune init proj hello
followed by “if … you can omit opam exec -- from the start of dune commands”. ??!
Seriously? How could they/you do that in this landing page for beginners?!
It would have been concise and easy to remember to write:
dune init proj hello
cd hello
dune build
dune exec hello
And putting some information about eval $(opam env) and opam exec -- in an appendix.
The Dune documentation appeared to first be simple in its (same) introduction (https://dune.readthedocs.io/en/stable/quick-start.html#initializing-projects ) then quickly became complicated mixing
Dune Quick-start initializing-a-library
and
Dune Quick-start building-a-hello-world-program-from-scratch
with a confusing syntax such as dune exec -- ./hello_world.exe without introducing context. Then, followed by a bunch of various examples.
Dune started again to make me headache… :
First, bin/ is (still) a place defined for holding… src / source program… (?!) Seriously ? Why naming that way?
The available ocaml and dune and other tools documentation seems not very consistent depending on the path you follow (VScode extension, ocaml.org, etc.)
.ocamlformat file is required to get formatting, but Dune doesn’t produce it while it pretends to be THE build system.
.merlin files seem not be used to handle while using ocaml-lsp-server.
Dune needs a first build to handle completion…
However Dune now has a watch mode (dune build -wand dune exec hello -w).
Dune produces an opam file but if you change the file dune-project, next build won’t update it…
It’s just the start and I think I need to be vigilant all the time to prevent that kind of problems.
Of course, I had no problem with ocamlc and agnostic Make files.
I didn’t find yet integration details in VScode (buttons and shortcuts except Shift+Enter (evaluate selection), F12 and Ctrl+Click on a value.
F12 is bound to Go to definition (say in stdlib).
Ctrl click on a value is bound to Jump to definition, and Alt+left arrow to get back (NOT mentioned in https://ocaml.org/docs/set-up-editor#2-jump-to-definitions-with-ctrl–click ) is nice (in VS code) .
I would have prefered a unique function to “go/jump to definition” accessed with F12 or Ctrl+click.
In 2025, I expected a much more nice experience with Ocaml tooling.
Is there a more straightforward and tested installation guide for linux? Windows? (OCaml and VScode, or whatever vim, Emacs)
For OCaml and VScode, is there a global installation script that handles all details and proposes some choices?
EDIT : My best wishes for 2026 to all of you, and to Ocaml!