I am on macOS 13.4, I set up my Ocaml environment with emacs but I'm still new at it so I got trouble solving some of my problems:

For the project I am working on I had to clone my working repository twice. The first repository works fine: merlin recognises the modules, I can C-c C-l to access the definition of objects, and the execution of the code C-x C-e works fine.


  • merlin toolkit v4.5-412
  • opam v2.1.4
  • dune v3.8.0
  • ocaml toplevel v4.12.1

Merlin doesn't seem to work in my second repository: the libraries installed, such as Irmin or Lwt aren't recognized, they are Not in environment when I try C-c C-l. Every call to the libraries shows the error Unbound module ....

Then I can't manage to execute the code with the opam switch of my second repository:

opam exec --switch=/Users/Louis/git/temp/learn-ocaml -- ocaml

in emacs returns the error

error "Buffer *OCaml* has no process"

When I try to save a file I also get the error message:

The current Merlin configuration has been generated by another, incompatible, version of Dune. Please rebuild the project. (Using the same version of Dune as the one running the `ocaml-merlin` server.)

I tried to solve the problem:

eval $(opam env)

and then M-x merlin-stop-server RET in emacs but I have the error

No config found for irmin-test.ml. Try calling `dune build`.

The dependencies used for compilation should be alright, and I made sure all the opam packages were installed.

I also tried to set the switch manually:

eval $(opam env --switch=/Users/Louis/git/temp/learn-ocaml --set-switch)

but it tells me

[ERROR] The selected switch /Users/Louis/git/temp/learn-ocaml is not installed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.