d2/docs/INSTALL.md

96 lines
2.4 KiB
Markdown
Raw Normal View History

# install
2022-11-22 00:46:05 +00:00
You may install D2 through any of the following methods.
<!-- toc -->
- [install.sh](#installsh)
- [macOS (Homebrew)](#macos-homebrew)
2022-11-21 08:02:39 +00:00
- [Standalone](#standalone)
- [From source](#from-source)
<!-- tocstop -->
## install.sh
2022-11-21 17:35:49 +00:00
The recommended and easiest way to install is with our install script, which will detect
the OS and architecture you're on and use the best method:
```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:
```sh
curl -fsSL https://d2lang.com/install.sh | sh -s -- --help
```
2022-11-21 08:02:39 +00:00
## macOS (Homebrew)
2022-11-22 00:37:33 +00:00
If you're on macOS, you can install with `brew`.
2022-11-21 08:02:39 +00:00
```sh
brew tap terrastruct/d2
brew install d2
```
2022-11-22 00:35:27 +00:00
> The install script above does this automatically if you have `brew` installed and
> are running it on macOS.
## Standalone
2022-11-22 00:35:27 +00:00
We publish standalone release archives for every release on Github.
2022-11-21 08:02:39 +00:00
Download the `.tar.gz` release for your OS/ARCH combination and then run the following
inside the extracted directory to install:
```sh
make install
```
2022-11-21 08:02:39 +00:00
Run the following to uninstall:
```sh
make uninstall
```
2022-11-22 00:35:27 +00:00
If root permissions are required for installation, you'll need to run `make` with `sudo`.
2022-11-21 08:02:39 +00:00
You can control the Unix hierarchy installation path with `PREFIX=`. For example:
```
# 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-22 00:35:27 +00:00
> warn: Our binary releases aren't fully static like normal Go binaries due to the C
> dependency on v8go for executing dagre. If you're on an older system with an old
> libc, you'll want to install from source.
2022-11-21 08:02:39 +00:00
## From source
2022-11-21 07:03:22 +00:00
2022-11-22 00:35:27 +00:00
You can always install from source:
2022-11-21 07:03:22 +00:00
```sh
2022-12-01 05:14:38 +00:00
go install oss.terrastruct.com/d2@latest
2022-11-21 07:03:22 +00:00
```
2022-11-21 17:31:05 +00:00
## Coming soon
- Docker image
- Windows install
- rpm and deb packages
2022-11-22 00:35:27 +00:00
- with repositories and standalone
2022-11-21 17:31:05 +00:00
- homebrew core