Setup OCaml with Dune in Under a Minute
Install Dune
Copy & Install
Getting Started
You can create and run your first hello-world program using Dune like this
Run
$ PROJECT=hello_world
$ dune init proj "$PROJECT"
$ cd "$PROJECT"
$ dune pkg lock
$ dune exec "$PROJECT"
Editor Configuration
Here is how to configure some popular editors for OCaml using the Dune Developer Preview. Note that it is unnecessary to install ocaml-lsp-server as Dune will install it automatically.
Visual Studio Code
Install version 1.21.0 or higher of the vscode-ocaml-platform plugin for Visual Studio Code. By default it assumes that you'll be using Opam to install ocamllsp. To configure it to work with the Dune Developer Preview, add the following to your settings.json file:
// settings.json
{
"ocaml.sandbox": {
"kind": "custom",
"template": "$prog $args"
}
}
Neovim
The easiest way to configure Neovim for OCaml is by installing the lspconfig package. The default configuration will work with the Dune Developer Preview, so just enable it with:
-- init.lua
require'lspconfig'.ocamllsp.setup{}
Emacs
Emacs users will need to add the Dune Developer Preview's bin directory to their exec-path and PATH variables. The rest of the configuration is the same as for regular OCaml. Here's a minimal example configuration for Emacs that uses use-package to install packages:
; init.el
; add the dune developer preview bin path to exec-path and PATH
(add-to-list 'exec-path "~/.dune/bin" t)
(setenv "PATH" (concat (expand-file-name "~/.dune/bin") ":" (getenv "PATH")))
; mode for editing ocaml files
(use-package tuareg)
; lsp client mode
(use-package lsp-mode
:init
; start ocamllsp automatically for ocaml files
:hook ((tuareg-mode . lsp)))
Zed
No manual configuration is necessary! Just install the OCaml extensions for Zed (you should get a pop-up the first time you edit an OCaml file).
For more information on Dune and Package Management, check the Dune docs, in particular the the package management tutorial and the the explanation how it works.
Share Feedback
We are excited to learn from your experience with the Dune Developer Preview, so feel encourage to tell us what you think
Frequently Asked Questions
What is the Dune Developer Preview?
The Dune Developer Preview is an ongoing program that provides early access to new and experimental features in Dune and the broader OCaml Platform. It's not limited to a single feature or time period – instead, it's a continuous initiative to involve the community in testing and refining upcoming developments.
While it currently showcases Dune's new package management capabilities, the Developer Preview will continue to introduce and iterate on various features even after the package management system is fully integrated into stable releases.
By participating in the Developer Preview, you'll have the opportunity to try out cutting-edge functionality, provide valuable feedback, and help shape the future of Dune and the OCaml ecosystem. We encourage users to think of the Developer Preview as a persistent "beta channel" for Dune and related tools, always offering a glimpse into what's coming next.
Is it stable?
No. For a stable release of OCaml, please follow the installation guide on OCaml.org. The Developer Preview is an unstable distribution of Dune and, by nature, will always be unstable. However, its features will stabilise over time and move to a stable release of Dune. If you use the Developer Preview, expect bugs and please report them to ocaml/dune.
Does it support Windows?
No, not yet. Watch this space for news!
Can I build the Developer Preview of Dune from sources?
Yes. The only difference from a regular build from source is in a few configuration flags. Please look in the Dune repository for complete instructions on how to do a source build of Dune.
When configuring the build you'll want to enable the following flags:
--enable-pkg-build-progress
--enable-lock-dev-tool
Can I access these features from a version of Dune managed by opam?
Yes, but we can't guarantee they will work correctly since the Dune Developer Preview makes some assumptions for package management that aren't supported by opam.
To enable these features make sure you are pinning dune to the development version, and export the following environment variables:
$ opam pin add dune --dev
$ export DUNE_CONFIG__PKG_BUILD_PROGRESS=enabled
$ export DUNE_CONFIG__LOCK_DEV_TOOL=enabled
Manual Installation
In this section you’ll find instructions to manually install the Dune Developer Review, and verify the installation. This is recommended for advanced users, or if you want s understand where the binaries come from.
Featured Downloads
This is the latest release of the Dune Developer Preview. See the release history section for all past releases.
Installing the Binary
After downloading a binary release of Dune, make it executable and place it somewhere reachable by your PATH:
Run
$ tar xzvf dune-<arch>.tar.gz
dune-<arch>
$ cd dune-<arch>
$ sudo mv "./dune" "$HOME/.local/bin/dune"
You can verify your installation by running:
$ dune --version
Dune Developer Preview: build , git revision cc260345db57ab639db6363b2dc89072a1492832
Verifying the Dune binary
To ensure trust in the binary distribution, we generate a build certificate associated with the Github Actions pipeline where the binaries are built. Once you download this certificate, you can use the gh tool to verify it with the following command:
$ gh attestation verify ./dune -R ocaml-dune/binary-distribution --bundle attestation.jsonl
Last Month Release History
Here is a list of the 30 latest releases of the Dune Developer Preview.
dune nightly-2024-11-21
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 7f23a4 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 7f23a4 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 7f23a4 |
dune nightly-2024-11-20
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 5ac095 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 5ac095 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 5ac095 |
dune nightly-2024-11-19
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 83d2ed | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 83d2ed | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 83d2ed |
dune nightly-2024-11-17
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | d8f763 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | d8f763 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | d8f763 |
dune nightly-2024-11-15
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 967f56 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 967f56 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 967f56 |
dune nightly-2024-11-14
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 6556ae | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 6556ae | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 6556ae |
dune nightly-2024-11-13
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | c5b60e | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | c5b60e | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | c5b60e |
dune nightly-2024-11-08
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | f7af2d | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | f7af2d | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | f7af2d |
dune nightly-2024-11-07
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 619c09 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 619c09 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 619c09 |
dune nightly-2024-11-06
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 619c09 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 619c09 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 619c09 |
dune nightly-2024-11-03
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 3296b1 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 3296b1 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 3296b1 |
dune nightly-2024-11-02
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | c2e016 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | c2e016 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | c2e016 |
dune nightly-2024-11-01
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 3ac95e | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 3ac95e | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 3ac95e |
dune nightly-2024-10-31
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | d27724 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | d27724 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | d27724 |
dune nightly-2024-10-30
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | d84d83 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | d84d83 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | d84d83 |
dune nightly-2024-10-28
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | b61e9d | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | b61e9d | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | b61e9d |
dune nightly-2024-10-27
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | b61e9d | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | b61e9d | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | b61e9d |
dune nightly-2024-10-23
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | bdbd30 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | bdbd30 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | bdbd30 |
dune nightly-2024-10-22
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | bd29b1 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | bd29b1 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | bd29b1 |
dune nightly-2024-10-21
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | dce464 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | dce464 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | dce464 |
dune nightly-2024-10-20
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 09b7a1 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 09b7a1 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 09b7a1 |
dune nightly-2024-10-19
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 82537f | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 82537f | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 82537f |
dune nightly-2024-10-18
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | ed871b | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | ed871b | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | ed871b |
dune nightly-2024-10-17
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | ed871b | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | ed871b | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | ed871b |
dune nightly-2024-10-16
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | ed871b | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | ed871b | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | ed871b |
dune nightly-2024-10-15
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 1becc6 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 1becc6 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 1becc6 |
dune nightly-2024-10-14
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 1becc6 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 1becc6 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 1becc6 |
dune nightly-2024-10-13
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 1becc6 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 1becc6 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 1becc6 |
dune nightly-2024-10-12
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 1becc6 | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 1becc6 | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 1becc6 |
dune nightly-2024-10-09
File Name | Kind | OS | Arch | Commit | Certificate |
---|---|---|---|---|---|
dune-aarch64-apple-darwin.tar.gz | Archive | macOS | aarch64 | 412a0f | |
dune-x86_64-apple-darwin.tar.gz | Archive | macOS | x86-64 | 412a0f | |
dune-x86_64-unknown-linux-musl.tar.gz | Archive | Linux | x86-64 | 412a0f |