Skip to content

Installation

MELPA

neocaml is available on MELPA. If you have MELPA in your package-archives, install it with:

M-x package-install <RET> neocaml <RET>

Or with use-package:

(use-package neocaml
  :ensure t)

From GitHub

You can install directly from the repository:

M-x package-vc-install <RET> https://github.com/bbatsov/neocaml <RET>

Or with use-package on Emacs 30+:

(use-package neocaml
  :vc (:url "https://github.com/bbatsov/neocaml" :rev :newest))

Note

If the required tree-sitter grammars are not installed, run M-x neocaml-install-grammars to install the OCaml and OCaml-interface grammars. If grammar installation fails, see Troubleshooting.

The modes for dune, opam, OCamllex, and Menhir files each use their own grammar. These are installed automatically when you first open a file of that type, or you can install them manually with M-x neocaml-dune-install-grammar, M-x neocaml-opam-install-grammar, M-x neocaml-ocamllex-install-grammar, and M-x neocaml-menhir-install-grammar.

Tip

If you have another OCaml major mode installed (e.g. tuareg or caml-mode), consider removing it to avoid conflicts over .ml and .mli file associations. See Migrating from tuareg / caml-mode for details.

What's Next?

Head to Getting Started to see what works out of the box, set up Eglot, and learn the basic workflow. Then check Configuration to customize font-lock levels, indentation, and more.