# d2 を Homebrew, dnf, MacPorts, Nix, pacman, zypper, scoop, winget でインストール

d2 のインストール経路、実行ファイル、メタデータ、AI エージェント向けセキュリティノートを確認します。

## インストール

```sh
sudo av install brew:d2
```

追加のインストールコマンド:

### macOS

- Homebrew (100%):

```sh
brew install d2
```

  証拠: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install d2
```

  証拠: MacPorts ports tree: graphics/d2/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- dnf (92%):

```sh
sudo dnf install d2
```

  証拠: Fedora Rawhide package metadata: d2 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#d2
```

  証拠: nixpkgs package indexes: pkgs/by-name/d2/d2/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- pacman (92%):

```sh
sudo pacman -S d2
```

  証拠: Arch Linux sync databases: d2 from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- zypper (92%):

```sh
sudo zypper install d2
```

  証拠: openSUSE Tumbleweed package metadata: d2 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

### Windows

- Scoop (92%):

```sh
scoop install main/d2
```

  証拠: Scoop official bucket manifest trees: bucket/d2.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1

- winget (92%):

```sh
winget install --id Terrastruct.D2 -e
```

  証拠: Windows Package Manager source index: Terrastruct.D2 from https://cdn.winget.microsoft.com/cache/source.msix

## パッケージ情報

- **パッケージキー:** brew:d2
- **パッケージマネージャ:** Homebrew
- **パッケージマネージャページ:** <https://formulae.brew.sh/formula/d2>
- **バージョン:** 0.7.1
- **ソース概要:** Modern diagram scripting language that turns text to diagrams
- **ホームページ:** <https://d2lang.com/>
- **リポジトリ:** <https://github.com/d2lang/d2>
- **上流ドキュメント:** <https://d2lang.com/>
- **ライセンス:** MPL-2.0
- **ソースアーカイブ:** <https://github.com/d2lang/d2/archive/refs/tags/v0.7.1.tar.gz>
- **最終更新:** 2026-08-01T19:58:36-07:00
- **生成日時:** 2026-08-04T22:13:35+00:00

## 実行可能ファイル

- d2 (cli)
- d2 (エイリアス)

## ビルド依存関係

- go

## インストール挙動

- post-install フック: 未定義
- Bottle: 利用可能 対象 arm64_linux, arm64_sequoia, arm64_sonoma, arm64_tahoe, arm64_ventura, sonoma, ventura, x86_64_linux

## バージョンと鮮度

- ページ生成日: 2026-08-04
- マネージャ版: 0.7.1
- マネージャ更新日: 2026-08-01
- ローカルデータ: OK
- 上流リポジトリ: https://github.com/d2lang/d2
- 検出された最新: v0.7.1 (最新)
## プロジェクトの歴史と使われ方

D2 is a modern diagram scripting language and CLI that turns text files into diagrams, especially for software architecture and documentation workflows.

### プロジェクトの歴史

The D2 repository was created in 2022 by Terrastruct. The README presents D2 as a language, command-line renderer, and Go library, with official documentation, a playground, themes, language tooling, plugins, and export formats.

### 採用の歴史

D2 entered the diagram-as-code ecosystem as another text-to-diagram option alongside tools such as Graphviz and Mermaid. Its README emphasizes package-manager installation, editor/tooling support, and a list of open-source projects that document with D2.

### 使われ方

The usual workflow is to write a .d2 file and run the d2 CLI to produce SVG, PNG, or PDF output. D2 can also be used as a Go library and can swap layout engines such as ELK or TALA.

### パッケージ好きにとっての重要性

D2 is package-manager friendly because it ships as a single CLI for docs pipelines: install it with a system package manager, keep diagrams as source text, and regenerate images in builds or documentation sites.

### タイムライン

- 2022: D2 repository created.
- 2022: Early v0.1.x tags published.
- 2025: v0.7.1 release published.

### Related projects

- D2 relates to diagram-as-code tools, Graphviz-style layout engines, ELK, TALA, Go documentation pipelines, and editor plugins.

### ソース

- <https://github.com/terrastruct/d2>
- <https://api.github.com/repos/terrastruct/d2>
- <https://github.com/terrastruct/d2/releases/tag/v0.7.1>
- <https://d2lang.com/>


## セキュリティノート

generalized runtime or code generation signal.

- **Geiger リスク:** yellow / 中
- generalized runtime or code generation signal

## ソースデータベース詳細

- **Source Database:** Homebrew formula API
- **Tap:** homebrew/core
- **Full Name:** d2
- **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

## 他のパッケージマネージャ記録

- Nix - d2: normalized package name match | nixpkgs package indexes: pkgs/by-name/d2/d2/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- dnf - d2 - 0.6.9-8.fc44: normalized package name match | Fedora Rawhide package metadata: d2 from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/210a2053c8e007daf9ae39c2a21daaed9b2ddd07d63ecffa597050361e73650c-primary.xml.zst | Modern diagram scripting language that turns text to diagrams | https://github.com/terrastruct/d2
- pacman - d2 - 0.7.1-2: normalized package name match | Arch Linux sync databases: d2 from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | A modern diagram scripting language that turns text to diagrams | https://d2lang.com
- zypper - d2 - 0.7.1-1.7: normalized package name match | openSUSE Tumbleweed package metadata: d2 from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | CLI tool and modern declarative language that turns text to diagrams | https://github.com/terrastruct/d2
- MacPorts - d2: normalized package name match | MacPorts ports tree: graphics/d2/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Scoop - main/d2: normalized package name match | Scoop official bucket manifest trees: bucket/d2.json from https://api.github.com/repos/ScoopInstaller/Main/git/trees/master?recursive=1
- winget - Terrastruct.D2: normalized package name match | Windows Package Manager source index: Terrastruct.D2 from https://cdn.winget.microsoft.com/cache/source.msix


## 関連リンク

- [Secret-risk packages](https://pkg.so/ja/secret-risk-packages/) - Has protected-tool coverage, approval-gate, or non-low Geiger security signals.
- [Terminal utility packages](https://pkg.so/ja/terminal-utilities/) - Matched terminal and command-line workflow metadata.
- [Text processing packages](https://pkg.so/ja/text-processing-tools/) - Matched text, document, or structured-data processing metadata.
- [Developer build packages](https://pkg.so/ja/developer-build-tools/) - Matched build, compiler, generator, or developer workflow metadata.
- [go](https://pkg.so/ja/brew/go/) - Build dependency declared by Homebrew.
- [plantuml](https://pkg.so/ja/brew/plantuml/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming, diagrams.
- [ditaa](https://pkg.so/ja/brew/ditaa/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming, diagrams.
- [sdedit](https://pkg.so/ja/brew/sdedit/) - Shares pkgdb curated category or tags: cli, developer-tools, diagram-as-code, diagramming.
- [mscgen](https://pkg.so/ja/brew/mscgen/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming.
- [clang-uml](https://pkg.so/ja/brew/clang-uml/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming.
- [eralchemy](https://pkg.so/ja/brew/eralchemy/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming.
- [likec4](https://pkg.so/ja/brew/likec4/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming.
- [msc-generator](https://pkg.so/ja/brew/msc-generator/) - Shares pkgdb curated category or tags: cli, developer-tools, diagramming.
- [diagram](https://pkg.so/ja/brew/diagram/) - Local package facts share a topical domain. Shared terms: cli, developer, developer-tools, diagram, diagramming.

## Combined YAML source

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