Plasma GitLab Archive
Projects Blog Knowledge

Looking up package directories

The package manager knows the preferred location for packages (this location is compiled in), which is usually /usr/local/lib/ocaml/site-lib. You can ask the package manager where package p is stored by simply typing

ocamlfind query p

and it will answer something like


There is an environment variable OCAMLPATH which can specify further directories where packages are stored. (The search order is: first the directories in OCAMLPATH in turn, then the default path set in ocamlfind.conf)

Historically, this kind of query was the first and only way of using ocamlfind, and because of the similiarity to the Unix find command it got its name. Finding out package locations is a basic but nethertheless important feature because it hides the details of the filesystem hierarchy. It is sufficient only to know the name of the package, and if needed, you can use the lookup mechanism implemented in ocamlfind to get the concrete directory.

This web site is published by Informatikb├╝ro Gerd Stolpmann
Powered by Caml