How can I install OCaml with OPam on windows?

pinkdolphin picture pinkdolphin · Sep 18, 2016 · Viewed 13.7k times · Source

How can I install OCaml with OPam on windows?

Answer

Trung Ta picture Trung Ta · Sep 26, 2016

I have been able to setup OCaml 4.03.0 in Windows 10, using the Opam package manager, by following the tutorial from this website: http://fdopen.github.io/opam-repository-mingw/. Here are the detailed steps that I did:

  • Install OCaml, Opam and Cygwin:

    • Download the installation package from this link: http://fdopen.github.io/opam-repository-mingw/installation/. There are both the 32 bit and 64 bit version, but I suggest to install the OCaml 64bit .

    • When running the graphical installation file, it will automatically install OCaml 4.02.3, Cygwin, Opam for you.

    • After installing, a shortcut for OCaml and Cygwin will be created on your Windows’ desktop.

  • Now, open the Cygwin terminal from the shortcut in your Windows’ desktop and do the followings:

    • Install some required libraries for Opam:

      • opam install depext
      • opam install depext-cygwinports
    • Upgrade your OCaml to 4.03.0 by using Opam:

      • opam switch 4.03.0+mingw64
      • eval `opam config env`

There you have OCaml 4.03.0 on Windows!