It is my pleasure to announce the following package for the dk0 build system that creates a Windows environment (“wenv”) containing OCaml using a custom Wine build for macOS:
Here is a sample session:
# Simplest way to install dk0 today. Use `git pull` if exists already.
$ git clone --branch V2_5 https://github.com/diskuv/dk.git dksrc
# Clear out data, cache and intermediate files from any prior
# experiments (from the "--trial" option seen in [ANN] posts)
$ rm -rf t/
# With the default Lua rules ("-I dksrc/etc/dk/v"), run the
# OCaml Windows environment creation rule ("run
# NotInriaCaml_Std.Wenv.Create@0.1.0"). Tell the rule to create the
# wenv at target/my-wenv/ ("dir=...") and make a mount
# ("mount[]=...") inside the wenv where the Unix directory $PWD is
# mapped to Windows M:\project. Depending on Internet, expect 3-4
# minutes for a single-threaded download of artifacts (581MB).
$ dksrc/dk0 --trial -I dksrc/etc/dk/v \
run NotInriaCaml_Std.Wenv.Create@0.1.0 \
dir=$PWD/target/my-wenv \
"mount[]=type=bind,src=$PWD,dst=M:/project"
# Then enter the wenv by running Command Prompt ("cmd.exe"). Turn
# off Wine debug messages ("WINEDEBUG=-all"). Remember that
# Ctrl-Z is the Windows equivalent of Ctrl-D (EOF) in Unix.
$ WINEDEBUG=-all target/my-wenv/bin/enter cmd.exe
Microsoft Windows 10.0.19045
Z:\> ocamlopt -config
Z:\> gcc --version
Z:\> dir M:
02/27/2026 10:24 AM <DIR> project
Z:\> ocaml
OCaml version 5.4.1
Enter #help;; for help.
# 1+1 ;;
- : int = 2
# ^Z
Z:\> echo let () = print_endline "abcxyz" > letters.ml
Z:\> ocamlopt -o letters.exe letters.ml
Z:\> .\letters.exe
abcxyz
Z:\> exit
Details:
- MinGW with UCRT Windows runtime and LLVM toolchain (llvm-mingw) for Wine on the host (macOS). X11 has been disabled.
- MinGW with MSVCRT Windows runtime and GNU compiler and BusyBox binaries (w64devkit) inside Windows guest.
- Wine has good support for programs that use Windows conventions (MSVC, Windows API rather than
syscall, etc). But there are important programs that won’t work correctly today: MSYS2/Cygwin, Rust uutils.
Enjoy! --jonah