# 使用 Homebrew, apk, apt, dnf, MacPorts, Nix, pacman, zypper 安装 ocaml

查看 ocaml 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:ocaml
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install ocaml
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install ocaml
```

  证据: MacPorts ports tree: lang/ocaml/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add ocaml
```

  证据: Alpine Linux edge package indexes: ocaml from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz

- Debian apt (92%):

```sh
sudo apt install ocaml
```

  证据: Debian stable package indexes: ocaml from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install ocaml
```

  证据: Fedora Rawhide package metadata: ocaml from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#ocaml
```

  证据: nixpkgs package indexes: ocaml from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

- pacman (92%):

```sh
sudo pacman -S ocaml
```

  证据: Arch Linux sync databases: ocaml from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install ocaml
```

  证据: openSUSE Tumbleweed package metadata: ocaml from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:ocaml
- **软件包管理器:** Homebrew
- **版本:** 5.5.0
- **来源摘要:** General purpose programming language in the ML family
- **主页:** <https://ocaml.org/>
- **仓库:** <https://github.com/ocaml/ocaml>
- **最后更新:** 2026-07-13T05:11:30Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- aarch64-unknown-linux-gnu-ocamlrun-a104 (别名)
- aarch64-unknown-linux-gnu-ocamlrund-a104 (别名)
- aarch64-unknown-linux-gnu-ocamlruni-a104 (别名)
- ocaml (别名)
- ocamlc (别名)
- ocamlc.byte (别名)
- ocamlc.opt (别名)
- ocamlcmt (别名)
- ocamlcp (别名)
- ocamldebug (别名)
- ocamldep (别名)
- ocamldep.byte (别名)
- ocamldep.opt (别名)
- ocamldoc (别名)
- ocamldoc.opt (别名)
- ocamllex (别名)
- ocamllex.byte (别名)
- ocamllex.opt (别名)
- ocamlmklib (别名)
- ocamlmktop (别名)
- ocamlobjinfo (别名)
- ocamlobjinfo.byte (别名)
- ocamlobjinfo.opt (别名)
- ocamlopt (别名)
- ocamlopt.byte (别名)
- ocamlopt.opt (别名)
- ocamloptp (别名)
- ocamlprof (别名)
- ocamlrun (别名)
- ocamlrun-a104 (别名)
- ocamlrund (别名)
- ocamlrund-a104 (别名)
- ocamlruni (别名)
- ocamlruni-a104 (别名)
- ocamlyacc (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 5.5.0
## 项目历史与用法

OCaml is the main implementation of the Caml branch of the ML family: a strict, statically typed, type-inferred language with functional, imperative, modular, and object-oriented features. The brewed ocaml package installs the compiler suite, runtime tools, lexer and parser generators, documentation tools, debugger, dependency analyzer, and native-code and bytecode compilers.

### 项目历史

OCaml grew out of Caml work at INRIA. Caml Special Light arrived in 1995 with an optimizing native-code compiler and a module system inspired by Standard ML; Objective Caml followed in 1996 after Didier Remy and Jerome Vouillon's object-type work was integrated into the language. The official name became OCaml in 2011.

The language evolved through major compiler and ecosystem changes. OCaml 4.0 in 2012 added GADTs and first-class modules; OCaml 4.03 in 2016 split ocamlbuild out of the compiler distribution; OCaml 5.0 in 2022 rewrote the runtime, removed the global runtime lock, and introduced support for shared-memory parallelism and effect handlers.

### 采用历史

OCaml began with a strong academic base and gained industrial users around the Objective Caml period documented by ocaml.org. The official history page identifies adoption in static analysis tools, compilers, financial systems, and web development, and the language ecosystem later consolidated around opam, Dune, odoc, ocamlformat, merlin, and related platform tools.

### 使用方式

Developers use OCaml for compilers, formal-methods tooling, static analysis, developer tools, financial infrastructure, web services, and systems where strong static typing and fast native code are useful. The package exposes both bytecode and native compilers, the interactive toplevel, ocamldebug, ocamldep, ocamldoc, ocamllex, ocamlyacc, and object-inspection tools.

### 为什么软件包爱好者会关心

OCaml is package-nerd rich because the compiler version is also an ecosystem axis. opam switches, findlib package names, Dune language versions, compiler-libs compatibility, PPX AST versions, and long-lived compiler branches all affect whether an OCaml package can build.

### 时间线

- 1995: Caml Special Light introduced an optimizing native-code compiler and a stronger module system.
- 1996: Objective Caml was released, combining object-oriented programming with ML-style polymorphic type inference.
- 2000: Optional arguments and polymorphic variants were added.
- 2011: The official language name became OCaml.
- 2012: OCaml 4.0 added GADTs and first-class modules.
- 2013: opam 1.0 established a source-based package manager for OCaml switches and packages.
- 2022-12-16: OCaml 5.0.0 introduced runtime support for shared-memory parallelism and effect handlers.
- 2026-06: The OCaml manual describes the 5.5 release line.

### Related projects

- opam is the source-based package manager for OCaml; Dune is the dominant build system; ocamlfind/findlib is the older library discovery layer; ocamlbuild is the legacy build manager; merlin and ocaml-lsp-server provide editor integration; odoc and ocamldoc cover documentation generation.

### 来源

- <https://discuss.ocaml.org/t/ocaml-5-0-0-is-out/10974>
- <https://formulae.brew.sh/formula/ocaml>
- <https://ocaml.org/history>
- <https://ocaml.org/manual>
- <https://ocaml.org/releases>
- <https://ocaml.org/releases/4.03.0>
- <https://opam.ocaml.org/>
- <https://opam.ocaml.org/about.html>


## 安全说明

generalized runtime or code generation signal.

- **Geiger 风险:** yellow / 中
- generalized runtime or code generation signal

## 其他软件包管理器记录

- Debian apt - libcompiler-libs-ocaml-dev - 5.3.0-3: normalized package name match | Debian stable package indexes: libcompiler-libs-ocaml-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OCaml compiler library (development files) | https://ocaml.org/
- Debian apt - libstdlib-ocaml - 5.3.0-3: normalized package name match | Debian stable package indexes: libstdlib-ocaml from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OCaml standard library (runtime files) | https://ocaml.org/
- Debian apt - libstdlib-ocaml-dev - 5.3.0-3: normalized package name match | Debian stable package indexes: libstdlib-ocaml-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OCaml standard library (development files) | https://ocaml.org/
- Debian apt - ocaml - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | ML language implementation with a class-based object system | https://ocaml.org/
- Debian apt - ocaml-base - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-base from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Runtime system for OCaml bytecode executables | https://ocaml.org/
- Debian apt - ocaml-base-nox - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-base-nox from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | transitional package for ocaml-base | https://ocaml.org/
- Debian apt - ocaml-compiler-libs - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-compiler-libs from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | transitional package for libcompiler-libs-ocaml-dev | https://ocaml.org/
- Debian apt - ocaml-interp - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-interp from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OCaml interactive interpreter and standard libraries | https://ocaml.org/
- Debian apt - ocaml-man - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-man from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | OCaml interpreter and standard libraries (lib manpages) | https://ocaml.org/
- Debian apt - ocaml-nox - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-nox from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | transitional package for ocaml | https://ocaml.org/
- Debian apt - ocaml-source - 5.3.0-3: normalized package name match | Debian stable package indexes: ocaml-source from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Sources for Objective Caml | https://ocaml.org/
- Nix - ocaml: normalized package name match | nixpkgs package indexes: ocaml from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - libcompiler-libs-ocaml-dev - 4.14.1-1ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: libcompiler-libs-ocaml-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | OCaml compiler library (development files) | https://ocaml.org/
- Ubuntu apt - libstdlib-ocaml - 4.14.1-1ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: libstdlib-ocaml from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | OCaml standard library (runtime files) | https://ocaml.org/
- Ubuntu apt - libstdlib-ocaml-dev - 4.14.1-1ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: libstdlib-ocaml-dev from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | OCaml standard library (development files) | https://ocaml.org/
- Ubuntu apt - ocaml - 4.14.1-1ubuntu1: normalized package name match | Ubuntu 24.04 LTS package indexes: ocaml from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | ML language implementation with a class-based object system | https://ocaml.org/


## Combined YAML source

View the package source record on GitHub. [combined/ocaml.yml](https://github.com/mxcl/pkgdb/blob/main/combined/ocaml.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
