2022-11-20 13:19:39 +00:00
|
|
|
# install
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
This file documents all the ways by which you can install D2.
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
<!-- toc -->
|
|
|
|
|
|
|
|
|
|
- [install.sh](#installsh)
|
|
|
|
|
- [macOS (Homebrew)](#macos-homebrew)
|
2022-11-21 08:02:39 +00:00
|
|
|
- [Standalone](#standalone)
|
|
|
|
|
- [From source](#from-source)
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
<!-- tocstop -->
|
|
|
|
|
|
|
|
|
|
## install.sh
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
# With --dry-run the install script will print the commands it will use
|
|
|
|
|
# to install without actually installing so you know what it's going to do.
|
|
|
|
|
curl -fsSL https://d2lang.com/install.sh | sh -s -- --dry-run
|
|
|
|
|
# If things look good, install for real.
|
|
|
|
|
curl -fsSL https://d2lang.com/install.sh | sh -s --
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
For help on the terminal run, including the supported package managers and detection
|
|
|
|
|
methods:
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
curl -fsSL https://d2lang.com/install.sh | sh -s -- --help
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
## macOS (Homebrew)
|
|
|
|
|
|
|
|
|
|
If you're on macOS, you can alternatively install with `brew`. (the install script above
|
|
|
|
|
does this automatically if you have `brew` installed).
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
brew tap terrastruct/d2
|
|
|
|
|
brew install d2
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-20 13:19:39 +00:00
|
|
|
## Standalone
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
We publish standalone release archives with every release on Github.
|
|
|
|
|
Download the `.tar.gz` release for your OS/ARCH combination and then run the following
|
|
|
|
|
inside the extracted directory to install:
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
make install
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
Run the following to uninstall:
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
make uninstall
|
|
|
|
|
```
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
You will be prompted for sudo/su/doas if root permissions are required for installation.
|
|
|
|
|
You can control the Unix hierarchy installation path with `PREFIX=`. For example:
|
2022-11-20 13:19:39 +00:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
# Install under ~/.local.
|
|
|
|
|
# Binaries will be at ~/.local/bin
|
|
|
|
|
# And manpages will be under ~/.local/share/man
|
|
|
|
|
# And supporting data like icons and fonts at ~/.local/share/d2
|
|
|
|
|
make install PREFIX=$HOME/.local
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The install script places the standalone release into `$PREFIX/lib/d2/d2-<version>`
|
|
|
|
|
and we recommend doing the same with manually installed releases so that you
|
|
|
|
|
know where the release directory is for easy uninstall.
|
|
|
|
|
|
|
|
|
|
|
2022-11-21 08:02:39 +00:00
|
|
|
## From source
|
2022-11-21 07:03:22 +00:00
|
|
|
|
2022-11-21 08:03:50 +00:00
|
|
|
Alternatively, you can always install from source:
|
2022-11-21 07:03:22 +00:00
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
go install oss.terrastruct.com/d2/cmd/d2@latest
|
|
|
|
|
```
|