.ml

How to open a .ml file

Quick, free ways to open OCaml on any system.

A .ml file is a OCaml Source File. If double-clicking does nothing, your computer simply does not have an app that reads OCaml yet. Here is how to fix that on each operating system, using free software wherever possible.

Open a .ml file step by step

  1. Confirm the file really is a .ml. Drop it into the WhatFileType file identifier, which reads its signature without uploading anything.
  2. On Windows, open it with VS Code (OCaml Platform) or any text editor.
  3. On Mac, use VS Code (OCaml Platform) or any text editor.
  4. On Linux, try VS Code (OCaml Platform) or Emacs (tuareg).
  5. Still stuck? Convert the .ml to exe (native, via dune), which opens more widely.

Best apps to open .ml files

Windows

  • VS Code (OCaml Platform)
  • any text editor

macOS

  • VS Code (OCaml Platform)
  • any text editor

Linux

  • VS Code (OCaml Platform)
  • Emacs (tuareg)
  • any text editor
!
Before you open it: Caution. An .ml file is program source. Compiling and running it executes its code; review unfamiliar files first.

Frequently asked questions

Why can't I open my .ml file?

Almost always because no installed app understands OCaml. Install one of the apps above, or convert the file to a format your existing software already reads.

How do I run an .ml file?

Use the OCaml toplevel (ocaml file.ml) for quick scripts, or build a project with dune, the standard OCaml build tool.

What is the difference between .ml and .mli?

The .ml file contains a module's implementation; the matching .mli file is its interface, listing exactly which types and functions other code may see.

Learn more about .ml