View on GitHub


Documenting everything about OCaml


Package Management

  • OPAM is the modern package manager for OCaml. If you want to publish a library in OCaml, OPAM is your friend, taking care of package dependency and invoking the build system as needed.
  • opam-check-all: shows you all OPAM packages and their build status on multiple versions of the compiler. Provides filtering for specific package versions, build errors, and package authors.
  • OPAM for Windows: OPAM repository modified for native Windows usage.
  • drom: A tool similar to Rust’s cargo, that allows easy creation and management of projects. Calls opam, dune and odoc as needed.
  • esy is a tool that is fully compatible with OPAM on the client side, while also allowing for the installation of ReasonML packages. Currently it is installed either via npm (the node.js package manager) or your operating system’s package manager. What esy brings to the table that OPAM lacks is the ability to cache all installed packages, allowing for reuse of binaries, and for the effortless creation of sandboxed environments for each of your projects.

Package Release System

  • dune-release: a tool for managing and releasing a package easily on OPAM. Built only for projects that use Dune as a build system. This is the tool you should use for easily updating your OPAM projects.
  • topkg: an alternative, older tool that allows you to easily release and maintain many OCaml packages at once. A little bit of extra metadata in your repo gives you the ability to use the topkg command line tools and manage your authored packages.

OCaml Build System

  • dune (formerly jbuilder) is a fast, easy to use build system for OCaml projects, and is seen as the main choice for new projects in OCaml. Dune can handle both OCaml (.ml) and Reason (.re) files.

    • mkocaml: tool for creating a new OCaml project using dune.
    • dune-starter: a sample project indicating ideal code layout for an OCaml project.
    • By default, Dune treats warnings as errors when building in the dev mode (ie. a local build). To change this, use this tip.
    • dune-deps: Allows you to view your dependencies in graph form.
    • Cache: Dune now includes an opt-in feature that shares build artifacts. See here.
  • ocamlscript: Allows you to run OCaml files as if they were scripts. Pre-compiles and runs them on the spot.

  • ocamlfind is a utility similar to pkg-config that allows local libraries to find each other on your system. You don’t need to have much awareness of ocamlfind nowadays because Dune and OPAM (see below) will do all the work, but it’s good to know about ocamlfind’s existence.

ReasonML Build System/Package Management

  • Reason lives in the Javascript ecosystem, and as such, its build tool of choice is Bucklescript, and its package management solution is npm

Legacy OCaml build systems

You may find some other build systems used by various OCaml projects. The general recommendation though is to stick with Dune whenever possible.

  • ocamlbuild : the option most used as a build tool before Dune came about.
  • Oasis : An older tool to integrate a configure, build and install system in your OCaml project. Before OPAM and Dune, this was a relatively easy way to create your project.
  • oasis2opam : Tool to convert OASIS metadata to OPAM package descriptions.
  • jenga : A monadic build system from Jane Street. Much of the underlying system used by Dune is composed of code from Jenga.
  • ocaml-makefile : Easy to use Makefile for small to medium-sized OCaml-projects.
  • obuild : Simple package build system for ocaml.