# 使用 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/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-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
- **软件包管理器页面:** <https://formulae.brew.sh/formula/ocaml>
- **版本:** 5.5.0
- **来源摘要:** General purpose programming language in the ML family
- **主页:** <https://ocaml.org/>
- **仓库:** <https://github.com/ocaml/ocaml>
- **上游文档:** <https://ocaml.org/>
- **许可证:** LGPL-2.1-only WITH OCaml-LGPL-linking-exception
- **源码归档:** <https://caml.inria.fr/pub/distrib/ocaml-5.5/ocaml-5.5.0.tar.xz>
- **最后更新:** 2026-07-13T05:11:30Z
- **已生成:** 2026-08-04T22:13:35+00:00

## 可执行文件

- aarch64-unknown-linux-gnu-ocamlrun-a104 (cli)
- aarch64-unknown-linux-gnu-ocamlrund-a104 (cli)
- aarch64-unknown-linux-gnu-ocamlruni-a104 (cli)
- ocaml (cli)
- ocamlc (cli)
- ocamlc.byte (cli)
- ocamlc.opt (cli)
- ocamlcmt (cli)
- ocamlcp (cli)
- ocamldebug (cli)
- ocamldep (cli)
- ocamldep.byte (cli)
- ocamldep.opt (cli)
- ocamldoc (cli)
- ocamldoc.opt (cli)
- ocamllex (cli)
- ocamllex.byte (cli)
- ocamllex.opt (cli)
- ocamlmklib (cli)
- ocamlmktop (cli)
- ocamlobjinfo (cli)
- ocamlobjinfo.byte (cli)
- ocamlobjinfo.opt (cli)
- ocamlopt (cli)
- ocamlopt.byte (cli)
- ocamlopt.opt (cli)
- ocamloptp (cli)
- ocamlprof (cli)
- ocamlrun (cli)
- ocamlrun-a104 (cli)
- ocamlrund (cli)
- ocamlrund-a104 (cli)
- ocamlruni (cli)
- ocamlruni-a104 (cli)
- ocamlyacc (cli)
- 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 (别名)

## 安装行为

- post-install 钩子: 未定义
- Bottle: 可用 于 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, sonoma, x86_64_linux

## 版本和新鲜度

- 页面生成时间: 2026-08-04
- 管理器版本: 5.5.0
- 管理器更新时间: 2026-07-13
- 本地数据: OK
- 上游仓库: https://ocaml.org/
- 信息: Release/tag comparison is only available for GitHub repositories.
## 项目历史与用法

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

## 源数据库详情

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** ocaml
- **Aliases:** o-caml, ocaml@5
- **Version Scheme:** 0
- **Revision:** 0
- **Head Version:** HEAD
- **Bottle Stable Root URL:** <https://ghcr.io/v2/homebrew/core>
- **Deprecated:** no
- **Disabled:** no
- **Keg Only:** no
- **URL Keys:** head, stable

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

- 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/


## 相关链接

- [Secret-risk packages](https://pkg.so/zh-hans/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/zh-hans/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Developer build packages](https://pkg.so/zh-hans/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [Language runtime packages](https://pkg.so/zh-hans/language-runtime-packages/) - Matched language runtime, compiler, or interpreter metadata.
- [rocq](https://pkg.so/zh-hans/brew/rocq/) - Popular package that depends on this formula.
- [cpdf](https://pkg.so/zh-hans/brew/cpdf/) - Popular package that depends on this formula.
- [ocaml-findlib](https://pkg.so/zh-hans/brew/ocaml-findlib/) - Popular package that depends on this formula.
- [camlp5](https://pkg.so/zh-hans/brew/camlp5/) - Popular package that depends on this formula.
- [ocamlbuild](https://pkg.so/zh-hans/brew/ocamlbuild/) - Popular package that depends on this formula.
- [erlang](https://pkg.so/zh-hans/brew/erlang/) - Shares pkgdb curated category or tags: cli, functional-programming, language-runtime, programming-language, programming-languages.
- [faust](https://pkg.so/zh-hans/brew/faust/) - Shares pkgdb curated category or tags: cli, compiler, functional-programming, language-runtime, programming-language.
- [fantom](https://pkg.so/zh-hans/brew/fantom/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, programming-languages.
- [odin](https://pkg.so/zh-hans/brew/odin/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, programming-languages.
- [erg](https://pkg.so/zh-hans/brew/erg/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, programming-languages.
- [oak](https://pkg.so/zh-hans/brew/oak/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, programming-languages.
- [futhark](https://pkg.so/zh-hans/brew/futhark/) - Shares pkgdb curated category or tags: cli, compiler, functional-programming, language-runtime, programming-language.
- [chezscheme](https://pkg.so/zh-hans/brew/chezscheme/) - Shares pkgdb curated category or tags: cli, compiler, language-runtime, programming-language, runtime.

## 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
- package-page enrichment
- curated package history
- package version freshness
- pkgdb category and tag curation
- package relationship graph
- external package-manager database matches
- cross-ecosystem install command graph
