ocamlfind
package manager for OCaml libraries
TLDR
Compile with package
SYNOPSIS
ocamlfind [ocamlc] [ocamlopt] [query] [list] [install] [-package pkgs] [options] [files]
DESCRIPTION
ocamlfind is the package manager for OCaml libraries. It locates installed packages and configures compiler invocations automatically.
The tool wraps OCaml compilers, adding include paths and library references based on package specifications. This simplifies builds by handling library dependencies.
Each package has a META file describing its components, dependencies, and locations. Query commands extract this information for build systems and scripts.
Package installation places libraries in a central repository with META files. This standardized layout enables reliable discovery and linking.
Dependencies are resolved transitively. Specifying a high-level package automatically includes its prerequisites.
Integration with build systems like Dune is common. Many projects use ocamlfind directly or through wrapper tools.
PARAMETERS
ocamlc ARGS
Run bytecode compiler.ocamlopt ARGS
Run native compiler.query PKG
Query package information.list
List installed packages.install PKG FILES
Install package.remove PKG
Remove package.-package PKGS
Packages to use (comma-separated).-linkpkg
Link packages into executable.-predicates PREDS
Set predicates.-syntax SYNTAX
Set syntax extension.-d
Show package directory.-r
Recursive dependencies.
CAVEATS
Replaced by opam for package installation in modern projects. Manual META file creation can be error-prone. Not all packages include META files.
HISTORY
ocamlfind (findlib) was created by Gerd Stolpmann starting in the early 2000s to standardize OCaml library management. It became the foundation for OCaml's package ecosystem, later complemented by opam for downloading and installing packages.
