InstallationΒΆ
Install on Windows:
winget install -e --id Diskuv.dkor Apple/Silicon:
sudo curl -o /usr/local/bin/dk https://diskuv.com/a/dk-exe/2.4.202506160116-signed/dk-darwin_arm64
sudo chmod +x /usr/local/bin/dkor Apple/Intel:
sudo curl -o /usr/local/bin/dk https://diskuv.com/a/dk-exe/2.4.202506160116-signed/dk-darwin_x86_64
sudo chmod +x /usr/local/bin/dkor Linux with glibc and libstdc++ (Debian, Ubuntu, etc. but not Alpine):
sudo curl -o /usr/local/bin/dk https://diskuv.com/a/dk-exe/2.4.202506160116-signed/dk-linux_x86_64
sudo chmod +x /usr/local/bin/dk
[ -x /usr/bin/dnf ] && sudo dnf install -y libstdc++ Say: Make it soΒΆ
Copy and paste in your Terminal (PowerShell on Windows) and wait for a minute until you see Make it so.:
dk -g dune -U "Tr1Stdlib_V414Io.StdIo.print_endline {|Make it so.|}" RunRun it again and it will be fairly quick:
dk -g dune -U "Tr1Stdlib_V414Io.StdIo.print_endline {|Make it so.|}" RunCongratulations, you have run your first script!
Cross-compilingΒΆ
Now copy and paste and wait for several minutes (the first time only!):
dk -g dune -S "
module Http = DkNet_Std.Http
module Uri = Tr1Uri_Std.Uri
let print_endline = Tr1Stdlib_V414Io.StdIo.print_endline
" -U "
print_endline @@
Lwt_main.run @@
Http.fetch_url ~max_sz:4096 @@
Uri.of_string {|https://jigsaw.w3.org/HTTP/h-content-md5.html|}
" -O ReleaseSmall ExeWhat happened? You created standalone executables for Linux and Windows and Android, all with one command, and if you are on macOS you also created standalone macOS executables.
Go ahead and find the standalone executable for your machine, and then run it:
target/ZzZz_Zz.Adhoc-android_arm32v7atarget/ZzZz_Zz.Adhoc-android_arm64v8atarget/ZzZz_Zz.Adhoc-android_x86_64target/ZzZz_Zz.Adhoc-darwin_arm64target/ZzZz_Zz.Adhoc-darwin_x86_64target/ZzZz_Zz.Adhoc-linux_x86target/ZzZz_Zz.Adhoc-linux_x86_64target/ZzZz_Zz.Adhoc-windows_x86_64.exetarget/ZzZz_Zz.Adhoc-windows_x86.exe
Using a script fileΒΆ
Let's save the last script to a file. Copy and paste the following (notice we use Run rather than -O ReleaseSmall Exe):
dk -g dune -S "
module Http = DkNet_Std.Http
module Uri = Tr1Uri_Std.Uri
let print_endline = Tr1Stdlib_V414Io.StdIo.print_endline
" -U "
print_endline @@
Lwt_main.run @@
Http.fetch_url ~max_sz:4096 @@
Uri.of_string {|https://jigsaw.w3.org/HTTP/h-content-md5.html|}
" RunYou will see that it prints the contents for you (scroll up a bit):
module Http = DkNet_Std.Http
module Uri = Tr1Uri_Std.Uri
let print_endline = Tr1Stdlib_V414Io.StdIo.print_endline
let () =
print_endline @@ Lwt_main.run
@@ Http.fetch_url ~max_sz:4096
@@ Uri.of_string {|https://jigsaw.w3.org/HTTP/h-content-md5.html|}Put that into a file; let's name it myfirstscript.ml.
Then run it with:
dk -g dune -s myfirstscript.ml RunCongratulations, you saved and ran your first script.
Next StepsΒΆ
You can:
- start the extended walk-through -or-
- browse the documentation

