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

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

## 安装

```sh
sudo av install brew:dub
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install dub
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install dub
```

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

### Linux

- apk (92%):

```sh
sudo apk add dub
```

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

- Debian apt (92%):

```sh
sudo apt install dub
```

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

- dnf (92%):

```sh
sudo dnf install dub
```

  证据: Fedora Rawhide package metadata: dub 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#dub
```

  证据: nixpkgs package indexes: pkgs/by-name/du/dub/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S dub
```

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

- zypper (92%):

```sh
sudo zypper install dub
```

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

## 软件包事实

- **软件包键:** brew:dub
- **软件包管理器:** Homebrew
- **版本:** 1.41.0
- **来源摘要:** Build tool for D projects
- **主页:** <https://code.dlang.org/getting_started>
- **仓库:** <https://github.com/dlang/dub>
- **最后更新:** 2026-06-22T14:03:12-07:00
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- dub (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

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

DUB is the package and build manager that gave the D language ecosystem a conventional registry-plus-build-tool workflow. It matters because it made reusable D libraries installable and buildable through a shared package description instead of scattered project-specific build scripts.

### 项目历史

The project describes itself as a package and build manager for D applications and libraries, with a central package registry at code.dlang.org. Its README says DUB emerged as a more general replacement for the package manager originally associated with vibe.d, then expanded from dependency management into building projects and generating IDE project files.

DUB's design center was deliberately small: a short dub.json or later package file, source in a conventional directory, and automatic dependency downloads during builds. That placed it in the same cultural slot as Cargo, npm, or Bundler, but tailored to D's compiler ecosystem and common D project layouts.

### 采用历史

DUB became the normal packaging path for public D libraries because the official registry, documentation, and compiler-facing workflow all point through it. The README records broad packaging support over time, including Homebrew, MacPorts, Chocolatey, Debian/Ubuntu, Arch, Alpine, FreeBSD, and OpenBSD.

Its adoption is also tied to IDE and editor integration. The project documentation notes VisualD project generation and Mono-D support for dub.json, which helped make DUB package metadata double as development-environment metadata.

### 使用方式

D developers use DUB to create packages, resolve dependencies, build executables and libraries, run tests, and publish packages to the D package registry. The common workflow is intentionally root-directory based: run dub from a package directory and let the package file describe dependencies and build settings.

DUB also has package-nerd value as an example of a language ecosystem build tool that grew out of a framework-specific need, then became the ecosystem-level package manager.

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

For package database work, DUB is a high-signal package because it is both a CLI and an ecosystem primitive: the executable is a developer tool, while the project also defines package metadata conventions for the D community.

It is historically interesting because it sits between older makefile-centric compiled-language workflows and newer language-native package managers. DUB made D packages discoverable through a central registry while still respecting multiple D compilers such as DMD, GDC, and LDC.

### 时间线

- 2010s: DUB emerges from vibe.d's package-manager needs and generalizes into a package and build manager for D.
- 2010s: code.dlang.org becomes the central DUB package registry.
- 2017: DUB 1.5 and 1.6 releases appear in the GitHub release history.
- 2020s: DUB remains the documented D package/build workflow and is packaged by mainstream OS package managers.

### Related projects

- vibe.d is central to DUB's origin story because DUB's README names it as the package manager that DUB generalized beyond.
- code.dlang.org is the registry side of the DUB ecosystem; VisualD and Mono-D are related development tools that consumed DUB package metadata.

### 来源

- <https://github.com/dlang/dub>
- <https://dub.pm/>
- <https://dub.pm/getting-started/install>
- <https://github.com/dlang/dub/releases>


## 安全说明

generalized runtime or code generation signal.

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


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: /var/lib/dub/settings.json, <dub executable folder>/../etc/dub/settings.json, /etc/dub/settings.json, $DUB_HOME/settings.json, $ROOT_PACKAGE_DIR/dub.settings.json
- Windows: %ProgramData%\dub\settings.json, <dub executable folder>\..\etc\dub\settings.json, %DUB_HOME%\settings.json, %ROOT_PACKAGE_DIR%\dub.settings.json
## 其他软件包管理器记录

- Debian apt - dub - 1.40.0-1: normalized package name match | Debian stable package indexes: dub from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | Package and build management system for D | https://code.dlang.org/
- Nix - dub: normalized package name match | nixpkgs package indexes: pkgs/by-name/du/dub/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - dub - 1.36.0-1ubuntu2: normalized package name match | Ubuntu 24.04 LTS package indexes: dub from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | Package and build management system for D | https://code.dlang.org/
- apk - dub - 1.41.0-r2: normalized package name match | Alpine Linux edge package indexes: dub from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Package and build management system for D | https://code.dlang.org/
- apk - dub-doc - 1.41.0-r2: normalized package name match | Alpine Linux edge package indexes: dub-doc from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Package and build management system for D (documentation) | https://code.dlang.org/
- apk - dub-zsh-completion - 1.41.0-r2: normalized package name match | Alpine Linux edge package indexes: dub-zsh-completion from https://dl-cdn.alpinelinux.org/alpine/edge/community/x86_64/APKINDEX.tar.gz | Zsh completions for dub | https://code.dlang.org/
- dnf - dub - 1.41.0-2.fc45: normalized package name match | Fedora Rawhide package metadata: dub from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Package and build management system for D | https://github.com/dlang/dub
- pacman - dub - 1.41.0-1: normalized package name match | Arch Linux sync databases: dub from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Developer package manager for D programming language | https://github.com/dlang/dub
- zypper - dub - 1.41.0-1.5: normalized package name match | openSUSE Tumbleweed package metadata: dub from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Package manager and meta build tool for the D programming language | https://code.dlang.org
- MacPorts - dub: normalized package name match | MacPorts ports tree: devel/dub/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1


## Combined YAML source

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


## 来源

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