Category Archives: OPAM

Getting to grips with OPAM

What is OPAM ?

OPAM is a OCaml Package Manager. Its basic use is similar to apt-get on linux, both package managers help to automate the process of installing, removing and updating software by tracking the complex web of dependencies that exist between bodies of code.
Why use OPAM ?

OPAM gives the user more control of the choice of specific libraries and compiler versions used to run OCaml code.

How to do I run OPAM ?

I am only going to run OPAM and not install it (long story). To do this, I executed the following from my root directory

wget http://opam.ocamlpro.com/build/opam64

chmod +x opam64

./opam64 init

How can install a package using OPAM ? What is the advantage over using OPAM intend of using the traditional methods ?

You can view the list of available packages using ./opam64 list and you can search using ./opam64 search .

On of the libraries used by Signposts is lwt. Lwt is a very useful library for anyone who want to do multi-threading in Ocaml. So I try the following query:

opam64 search lwt

Available packages for system:

cohttp   --  HTTP library for Lwt, Async and Mirage

lwt   --  A cooperative threads library for OCaml

lwt-zmq   --  Lwt-friendly wrapping around ZeroMQ sockets

release   --  Release is a multi-process Lwt-enabled daemon framework for OCaml.

The second of these results is the package that I want to install so

How do I install a package from a Ocaml project on Git ?

Firstly find the package that you want to install, for me this is git://github.com/mirage/opam-repo-dev

opam remote -add dev git://github.com/mirage/opam-repo-dev
Now in future, when I issue opam upgrade, the latest version of the git repo will be downloaded and any depandencies recompiled