[ANN] OCaml ports updated in MacPorts

I recognize many Mac users are on brew these days, but for those using MacPorts, I’ve just updated the OCaml port to 4.05.0, and updated the ports for a variety of related infrastructure like findlib, ocamlbuild, etc.

If you decide to bootstrap your opam environment via MacPorts, it should work pretty well, and I’ll be maintaining this infrastructure going forward.

One interesting problem remaining is what to do about a bunch of non-OCaml ports in the MacPorts infrastructure that depend on OCaml and OCaml packages. Such things can’t really depend on opam too much. Ideally, I’d like to be able to get opam to do the builds of the packages they depend on, but this requires having a mode where opam will do nothing more than build a single package to a staging area rather than fetching all dependencies on its own, installing to the final location, etc. If any opam types would be willing to help me figure out how to do that, it would be appreciated.


Last time I checked, many OCaml packages in NixOS did what you describe: use opam only for building, and nix for the rest. Maybe you can try to look at how they do it.

1 Like

I’d be very interested if anyone knows the details of this. (I don’t know anything about NixOS, unfortunately.)

1 Like

I used to be a MacPorts user some months ago.

At that time, Opam did not work with MacPorts. It was failing to install new packages properly.

After some digging in the source, I could find that MacPorts was looking for the pkg-config utility at /usr/local/bin/pkg-config, whereas it is installed by MacPorts at /opt/local/bin/pkg-config or something like that.

It was so disturbing that I switched to HomeBrew with my new Mac. Well, this may actually be the hidden agenda of OPAM. :slight_smile:


That wasn’t MacPorts. That was you setting /usr/local first in your path. Then, naturally it will find what you put in /usr/local first. Unfortunate that you asked your shell to do that, but it’s not within the control of MacPorts. You could have tried asking for help and someone would have told you the problem. BTW, MacPorts itself will never look outside of its own tools, it’s careful about its own path.

MacPorts works the best. I’ve had few problems (mostly opam related) using this on hackintosh, so thanks a lot for your hard work :slight_smile: There are sometimes queer problems upgrading in those cases, re-installing opam might be a good idea. It doesn’t take too long to install anyhow, I can reinstall most packages from opam easily.