# OCaml and Windows

**URL:** <https://discuss.ocaml.org/t/ocaml-and-windows/3282>\
**Category:** Community\
**Created:** [February 5, 2019, 4:33am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282 "2019-02-05T04:33:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![XVilka](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xvilka/32/5334_2.png) [@XVilka](https://discuss.ocaml.org/u/XVilka)\
**Post date:** [February 5, 2019, 4:33am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/1 "2019-02-05T04:33:39Z")

</div>

I know there are slowly ongoing efforts on improving OCaml support of Windows platform, but so far they look patchy and incomplete. And Windows users have to stuck to F# which is only a bleak shadow of OCaml obviously. Is there any roadmap or comprehensive plan to overturn the tables and beat F# on its own territory?

> **[ocaml/ocaml](https://github.com/ocaml/ocaml/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Aopen+Windows)**
>
> The core OCaml system: compilers, runtime system, base libraries - ocaml/ocaml

> <https://github.com/ocaml/opam/issues/2191>

---

<div class="post-metadata">

**Author:** ![yawaramin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/yawaramin/32/3384_2.png) [@yawaramin](https://discuss.ocaml.org/u/yawaramin)\
**Post date:** [February 5, 2019, 6:05am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/2 "2019-02-05T06:05:22Z")

</div>

Apparently Esy works on Windows (I don’t have a Windows machine handy so haven’t tried it): [https://esy.sh/docs/en/what-why.html](https://esy.sh/docs/en/what-why.html) . It could be a good way for you to bootstrap.

There’s experimental support for building pure-opam projects: [https://esy.sh/docs/en/opam-workflow.html](https://esy.sh/docs/en/opam-workflow.html)

---

<div class="post-metadata">

**Author:** ![bsansouci](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/bsansouci/32/41_2.png) [@bsansouci](https://discuss.ocaml.org/u/bsansouci)\
**Post date:** [February 11, 2019, 10:14pm UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/3 "2019-02-11T22:14:26Z")

</div>

Feel free to give [bsb-native](https://github.com/bsansouci/bucklescript) a try as well. Version 4.0.7000 should fully work on windows, without needing WLS or Cygwin. You should be able to just `npm install bsb-native` and it’ll work on your `.ml` files.

---

<div class="post-metadata">

**Author:** ![keleshev](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/keleshev/32/3779_2.png) [@keleshev](https://discuss.ocaml.org/u/keleshev)\
**Post date:** [February 11, 2019, 10:42pm UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/4 "2019-02-11T22:42:36Z")

</div>

I have used OCaml on Windows with Cygwin for years now. I think it is decent.

[Opam for Windows](https://fdopen.github.io/opam-repository-mingw/) works fine. Don’t know what kind of more compatibility is necessary, or is being worked on, but I haven’t hit any serious issues, despite pretty complex use-cases.

[CSML](https://github.com/LexiFi/csml) makes it quite easy to make .NET bindings.

Merlin and Visual Studio Code work very well on Windows.

I’ve also used Dune, Lwt, Cohttp on Windows.

---

<div class="post-metadata">

**Author:** ![hcarty](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/hcarty/32/1824_2.png) [@hcarty](https://discuss.ocaml.org/u/hcarty)\
**Post date:** [February 12, 2019, 1:47am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/5 "2019-02-12T01:47:40Z")

</div>

@keleshev What configuration do/did you use for vscode + merlin under opam for Windows? Last time I tried it didn’t work well but I haven’t tried in a while.

Outside of editing, I’ve used the same tools and libraries @keleshev mentioned for building tools and services on Windows. I haven’t tried esy yet but I plan to soon.

---

<div class="post-metadata">

**Author:** ![keleshev](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/keleshev/32/3779_2.png) [@keleshev](https://discuss.ocaml.org/u/keleshev)\
**Post date:** [February 12, 2019, 9:24am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/6 "2019-02-12T09:24:29Z")

</div>

@hcarty I make sure that `ocamlmerlin-server` is on `PATH` in my Cygwin console, then I call `code` from within the console so that it inherits the path. In the editor settings I have only this:

```auto
"reason.path.ocamlmerlin": "ocamlmerlin-server",

```

---

<div class="post-metadata">

**Author:** ![XVilka](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xvilka/32/5334_2.png) [@XVilka](https://discuss.ocaml.org/u/XVilka)\
**Post date:** [February 13, 2019, 5:15am UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/7 "2019-02-13T05:15:28Z")

</div>

Cygwin is not native Windows development. I am speaking about proper port, with complete native support.

---

<div class="post-metadata">

**Author:** ![keleshev](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/keleshev/32/3779_2.png) [@keleshev](https://discuss.ocaml.org/u/keleshev)\
**Post date:** [February 13, 2019, 12:41pm UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/8 "2019-02-13T12:41:11Z")

</div>

@XVilka just to make sure we are on the same foot here, [OCaml for Windows](https://fdopen.github.io/opam-repository-mingw/) uses a cross-compiler version of GCC to produce native Windows executables which are independent of Cygwin and do not link to `cygwin1.dll`.

---

<div class="post-metadata">

**Author:** ![fdopen](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/fdopen/32/452_2.png) [@fdopen](https://discuss.ocaml.org/u/fdopen)\
**Post date:** [February 13, 2019, 1:01pm UTC](https://discuss.ocaml.org/t/ocaml-and-windows/3282/9 "2019-02-13T13:01:54Z")

</div>

A Unix shell is needed during the build step for many packages: OCaml itself, every package that uses ocamlbuild, zarith, and many more. Even packages that use dune, frequently rely on something like `(bash <cmd>)` or `(run sh ./foo.sh)`. If you want to get rid of something like WSL or cygwin, you have to convince them to switch their build system (OCaml 4.08.0 just switched to autoconf 😉).

Also opam internally relies on programs that are not available as native Windows application: rsync, git,…
