# 使用 Homebrew, apk, apt, dnf, MacPorts, pacman, scoop, zypper 安装 libxml2

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

## 安装

```sh
sudo av install brew:libxml2
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install libxml2
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install libxml2
```

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

### Linux

- apk (92%):

```sh
sudo apk add libxml2
```

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

- Debian apt (92%):

```sh
sudo apt install libxml2
```

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

- dnf (92%):

```sh
sudo dnf install libxml2
```

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

- pacman (92%):

```sh
sudo pacman -S libxml2
```

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

- zypper (92%):

```sh
sudo zypper install libxml2-16
```

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

### Windows

- Scoop (92%):

```sh
scoop install main/libxml2
```

  证据: Scoop official bucket manifest trees: bucket/libxml2.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

## 软件包事实

- **软件包键:** brew:libxml2
- **软件包管理器:** Homebrew
- **版本:** 2.15.3
- **来源摘要:** GNOME XML library
- **主页:** <http://xmlsoft.org/>
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- xml2-config (别名)
- xmlcatalog (别名)
- xmllint (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

libxml2 is the GNOME XML C parser and toolkit, but its reach extends far beyond GNOME. It became one of the default XML implementations for Unix-like systems because it combines parser, tree API, validation support, HTML parsing, catalog handling, command-line tools, and language bindings in a portable C library.

### 项目历史

The libxml2 documentation describes the project as an XML toolkit implemented in C and originally developed for the GNOME Project. The historical xmlsoft.org documentation credited Daniel Veillard as the maintainer and pointed users to GNOME CVS modules for libxml2 and libxslt.

GNOME's release archive contains the libxml2 2.0.0 source tarball dated 2000-04-12. The project's public documentation records the GNOME GitLab repository and the GNOME download archive as official locations, showing the migration from the older xmlsoft/GNOME CVS era to GNOME-hosted GitLab and generated API documentation.

### 采用历史

libxml2 was adopted widely because XML was a core interchange format for desktop files, configuration formats, documentation systems, web service stacks, office formats, and build tooling. Its permissive MIT license, C API, portability, and bindings made it attractive to distributions and application runtimes.

The command-line tools xmllint and xmlcatalog gave the library a direct package-manager presence. Even users who never linked libxml2 could install the package to validate XML, inspect documents, test XPath expressions, or manage XML catalogs in build and documentation pipelines.

### 使用方式

Common package usage includes linking against libxml2 for parsing and validation, using xmllint in scripts and tests, and using xmlcatalog where systems rely on XML catalog resolution. It is also a dependency layer for related XML software such as libxslt and xmlsec.

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

libxml2 is package-nerd infrastructure: small enough to be considered a library dependency, but important enough that parser behavior, security fixes, and ABI expectations affect browsers, language ecosystems, desktop software, and distro bootstrap graphs. Its presence in package managers is a sign that XML support is part of the Unix substrate rather than a niche add-on.

### 时间线

- 2000: GNOME's source archive lists libxml2 2.0.0 dated 2000-04-12.
- 2002: Historical xmlsoft documentation points to GNOME CVS modules for libxml2 and libxslt.
- 2022: GNOME-hosted API documentation records the project repository on GNOME GitLab.
- 2026: GNOME's source archive lists maintained 2.x release directories through the 2.15 series.

### Related projects

- libxslt builds on the same GNOME XML stack for XSLT processing. XML Security Library uses libxml2 as its XML foundation. Higher-level bindings and wrappers expose libxml2 to languages such as Python, Perl, Ruby, PHP, and others.

### 来源

- <https://download.gnome.org/sources/libxml2/>
- <https://download.gnome.org/sources/libxml2/2.0/>
- <https://gnome.pages.gitlab.gnome.org/libxml2/>
- <https://web.mit.edu/ghudson/dev/nokrb/third/libxml2/doc/downloads.html>


## 安全说明

library-like package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- library-like package without higher-risk signals

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

- Debian apt - libxml2 - 2.12.7+dfsg+really2.9.14-2.1+deb13u3: normalized package name match | Debian stable package indexes: libxml2 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNOME XML library | http://xmlsoft.org
- Debian apt - libxml2-dev - 2.12.7+dfsg+really2.9.14-2.1+deb13u3: normalized package name match | Debian stable package indexes: libxml2-dev from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNOME XML library - development files | http://xmlsoft.org
- Debian apt - libxml2-doc - 2.12.7+dfsg+really2.9.14-2.1+deb13u3: normalized package name match | Debian stable package indexes: libxml2-doc from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNOME XML library - documentation | http://xmlsoft.org
- Debian apt - libxml2-utils - 2.12.7+dfsg+really2.9.14-2.1+deb13u3: normalized package name match | Debian stable package indexes: libxml2-utils from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNOME XML library - utilities | http://xmlsoft.org
- Debian apt - python3-libxml2 - 2.12.7+dfsg+really2.9.14-2.1+deb13u3: normalized package name match | Debian stable package indexes: python3-libxml2 from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | GNOME XML library - Python3 bindings | http://xmlsoft.org
- Ubuntu apt - libxml2 - 2.9.14+dfsg-1.3ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libxml2 from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | GNOME XML library | http://xmlsoft.org
- Ubuntu apt - libxml2-dev - 2.9.14+dfsg-1.3ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libxml2-dev from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | GNOME XML library - development files | http://xmlsoft.org
- Ubuntu apt - libxml2-doc - 2.9.14+dfsg-1.3ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libxml2-doc from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | GNOME XML library - documentation | http://xmlsoft.org
- Ubuntu apt - libxml2-utils - 2.9.14+dfsg-1.3ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: libxml2-utils from https://archive.ubuntu.com/ubuntu/dists/noble/main/binary-amd64/Packages.gz | GNOME XML library - utilities | http://xmlsoft.org
- Ubuntu apt - python3-libxml2 - 2.9.14+dfsg-1.3ubuntu3: normalized package name match | Ubuntu 24.04 LTS package indexes: python3-libxml2 from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | GNOME XML library - Python3 bindings | http://xmlsoft.org
- apk - libxml2 - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2 from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML parsing library, version 2 | https://gitlab.gnome.org/GNOME/libxml2
- apk - libxml2-dbg - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2-dbg from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML parsing library, version 2 (debug symbols) | https://gitlab.gnome.org/GNOME/libxml2
- apk - libxml2-dev - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2-dev from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML parsing library, version 2 (development files) | https://gitlab.gnome.org/GNOME/libxml2
- apk - libxml2-doc - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML parsing library, version 2 (documentation) | https://gitlab.gnome.org/GNOME/libxml2
- apk - libxml2-static - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2-static from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML parsing library, version 2 (static library) | https://gitlab.gnome.org/GNOME/libxml2
- apk - libxml2-utils - 2.13.9-r2: normalized package name match | Alpine Linux edge package indexes: libxml2-utils from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | XML utilities | https://gitlab.gnome.org/GNOME/libxml2


## Combined YAML source

View the package source record on GitHub. [combined/libxml2.yml](https://github.com/mxcl/pkgdb/blob/main/combined/libxml2.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
