OCaml for ARM MacOS


I’ve never built ocaml or opam from source. Do you think you can give me the idiot-proof guide for getting this up an running on my ARM-based mac?

This might help
Opam: Release 2.0.7 · ocaml/opam · GitHub

And latest release of Ocaml 4.10 and the beta 4.12 has support for MacOSX/Arm64

It’s quite easy to get up to speed using the precompiled OPAM binary for macOS/ARM64.

  • Download opam-2.0.7-arm64-macos.

  • Move it to some directory in your PATH, rename it to opam, and make it executable. From a Terminal window:

mv ~/Downloads/opam-2.0.7-arm64-macos /usr/local/bin/opam
chmod +x /usr/local/bin/opam
  • Try to execute it: opam init. You will be blocked by the macOS security checks, as the binary is not signed.

  • Open Preferences / Security and Privacy. There should be a notice “opam was blocked because…” and an “Allow Anyway” button. Click on that button.

  • Try again to execute opam init. You will be blocked again, but now there is an “Open” button. Click on that button. opam init should run and install the OCaml 4.10.2 compiler.

  • From now on, you can run opam without being blocked. Use this freedom to opam install the packages you need.

  • Some packages that depend on external C libraries may fail to install because these C libraries are not available. Normally we would rely on Homebrew or MacPorts to provide these C libraries, but these package collections are still being ported to macOS/ARM64.

As a reward for these minor inconveniences, you’ll get excellent performance running OCaml software such as Coq. Single-core performance on a MacBook Air M1 is 20% better than the best x86 workstation I have access to.


I noticed that opam 2.08 is now available for ARM Macs using Homebrew, and I was able to confirm on my machine.

brew install opam away :slight_smile: