opam

Automate OCaml package management with opam subcommands and environment integration.

60|13|Updated Dec 22, 2025
One-click install
npx skills add https://github.com/plurigrid/asi --skill opam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opam
Source: https://github.com/plurigrid/asi/tree/main/skills/opam
Command: npx skills add https://github.com/plurigrid/asi --skill opam

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides OCaml developers through installing, switching, pinning, and managing packages with the opam toolchain.

Core Features & Use Cases

  • Package management: Install, upgrade, and remove OCaml packages.
  • Switch management: Create and list compiler switches.
  • Repository interaction: Add or update opam repositories.

Quick Start

Initialize an OCaml project by installing dependencies and selecting a switch, e.g., opam install dune merlin and opam switch create 5.1.0.

Frequently Asked Questions about opam

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I install and manage OCaml packages for my project?

opam is OCaml's package manager that automates dependency installation and management. Use `opam install` to add packages like dune and merlin, `opam upgrade` to update them, and `opam remove` to uninstall. opam tracks all dependencies across your project workspace.

What is an opam switch and how do I create one?

An opam switch isolates OCaml compiler versions and package sets for different projects. Create a switch with `opam switch create 5.1.0` to pin a specific compiler version, or list existing switches with `opam switch list`. Each switch maintains its own environment and dependencies.

How do I pin a local or remote OCaml package with opam?

opam pinning locks a package to a specific version or local path, useful for development and testing. Use `opam pin add package-name /path/to/local` for local packages or `opam pin add package-name https://github.com/user/repo` for remote sources. Pinned packages override repository versions.

Can I add custom opam repositories to my project?

Yes, opam supports custom repository management. Add repositories with `opam repository add`, list configured ones with `opam repository list`, update them with `opam repository update`, and search packages with `opam search`. This lets you access private or alternative package sources.

Do I need to manually configure my shell environment after installing opam?

No, opam automates environment setup. Run `eval $(opam env)` to integrate opam into your current shell session, or opam handles this automatically in new sessions. This sets up paths and variables needed for the active switch and installed packages.

What OCaml build tools work with opam package management?

dune is the standard OCaml build system and integrates seamlessly with opam. Install dune via `opam install dune`, and opam resolves its dependencies automatically. opam handles compilation and linking after dune orchestrates the build.