Installing emacs caml-mode

I’m trying to install caml-mode on emacs using opam, and it fails with “sandbox-exec: execvp() of ‘emacs’ failed: No such file or directory”. I don’t know enough about opam or installing emacs packages to have any idea how to proceed from that. Any suggestions? Or should I take this to an emacs forum?

In case it’s helpful, I’m using emacs 27.2.1 on a Mac running macOS 11.6 Big Sur.

Try investigating merlin.

Try this instead:

sudo apt install tuareg-mode

Sometimes, relying on your Linux distro is not a bad thing.
You could also try:

opam user-setup install

He is using a mac, but maybe there is a homebrew package anyway.

Merlin is complementary to caml-mode it does not replace it.

I have the same here and it works. Do you have emacs in your PATH ? What does

command -v emacs 

Say ?

Thank you all for the helpful suggestions! As dbuenzli suspected, the problem was that emacs wasn’t in my PATH. (That’s because I’m using a Mac and have been starting emacs the Mac way rather than the Unix way.) I added it to PATH, and then “opam install caml-mode user-setup” worked without problem.

Note that if you install emacs via brew install emacs it gives you both the macOS app and an emacs script in /usr/local/bin.