A Cargo-like experience
for OCaml

One command surface, zero manual switch management. oc orchestrates opam and dune so you never have to.

$ curl -sSfL https://raw.githubusercontent.com/emilkloeden/oc/main/install.sh | sh

See it in action

No switch setup. No environment sourcing. Just write OCaml.

oc demo: oc new my_app, oc add yojson, oc run

What oc handles for you

Zero switch management

Every project gets an isolated opam switch, created and activated automatically.

🔒

Lockfile

oc.lock records exact installed versions. Commit it for reproducible builds across machines.

♻️

Shared switch cache

Projects with identical dependencies share a single switch at ~/.cache/oc/switches/. No redundant installs.

📦

Simple config

One oc.toml file describes your project. The .opam file is generated — never edit it by hand.

Why oc?

Setting up a new OCaml project without oc looks like this:

Without oc

opam switch create my_app 5.2.0
eval $(opam env)
opam install dune yojson
dune init project my_app

With oc

oc new my_app
oc add yojson
oc build

oc doesn't replace opam or dune — it orchestrates them so you don't have to think about them.

Installation

Requires opam and git on your PATH.

macOS / Linux

curl -sSfL https://raw.githubusercontent.com/emilkloeden/oc/main/install.sh | sh

Installs to /usr/local/bin. To install elsewhere:

curl -sSfL https://raw.githubusercontent.com/emilkloeden/oc/main/install.sh | INSTALL_DIR=~/.local/bin sh

Manual

Download the binary for your platform from the latest release, extract it, and place oc on your PATH.

Build from source

Requires Go 1.22+.

git clone https://github.com/emilkloeden/oc
cd oc
go build -o ~/.local/bin/oc .