# Install d2 with Homebrew

Modern diagram scripting language that turns text to diagrams. Version 0.7.1 via Homebrew; verified 2026-08-01.

## Install

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

Additional install commands:

### macOS

- Homebrew (100%):

```sh
brew install d2
```

  Evidence: provider-native install command

## Package facts

- **Package key:** brew:d2
- **Package manager:** Homebrew
- **Version:** 0.7.1
- **Source summary:** Modern diagram scripting language that turns text to diagrams
- **Homepage:** <https://d2lang.com/>
- **Repository:** <https://github.com/terrastruct/d2>
- **Last updated:** 2026-08-01T19:58:36-07:00
- **Generated:** 2026-08-03T00:40:33+00:00

## Executables

- d2 (alias)

## Install behavior

- Bottle: not available

## Freshness

- Page generated: 2026-08-03
- Package-manager version: 0.7.1
## Project history and usage

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

### Project history

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.

### Adoption history

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.

### How it is used

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.

### Why package nerds care

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.

### Timeline

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

### Sources

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


## Security Notes

generalized runtime or code generation signal.

- **Geiger risk:** yellow / medium
- generalized runtime or code generation signal


## Combined YAML source

View the package source record on GitHub. [combined/d2.yml](https://github.com/automic-vault/db/blob/main/combined/d2.yml)


## Sources

- Nucleus package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
