Skip to content

Installation

You can get dog installed various ways on Mac & Linux. Scroll down to read about building from source, including how to pick just the languages you need for a smaller binary.

Pick a method

sh
curl -fsSL https://sh.dog/install | sh
sh
brew tap edden27/dog
brew trust edden27/dog
brew install dog
sh
curl -L https://github.com/edden27/dog/releases/latest/download/dog-macos-arm64.tar.gz | tar xz
sudo mv dog /usr/local/bin/
sh
git clone https://github.com/edden27/dog
cd dog
make build && make install

INFO

The install script checks which binary is right for your machine and installs it to /usr/local/bin — or ~/.local/bin if that isn't writable. It also handles adding tab completions for your default shell.

INFO

Homebrew installs dog and its shell completions, on both Mac and Linux. When a new version ships, run brew upgrade dog to get it.

Before copying this command

There's a build for each Mac and Linux chip type: arm64 is Apple Silicon (M1 and later) and ARM Linux, x86_64 is Intel. The command here grabs the Apple Silicon Mac build — swap the filename for yours, for example dog-macos-x86_64.tar.gz on an Intel Mac or dog-linux-x86_64.tar.gz on Intel Linux.

WARNING

Building from source needs Swift 6.3 or newer — that's Xcode 26 on a Mac, or the swift.org toolchain on Linux. See Advanced for a no-sudo path.

Verify:

sh
dog --version

Expected output:

0.1.0

Requirements

  • Running dog: macOS 14+ or Linux. The Linux binaries bundle the Swift runtime — nothing to install first.
  • Building from source: Swift 6.3 or newer. On macOS that means Xcode 26; on Linux, the swift.org toolchain.

Shell completions

dog generates its own completion script for bash, zsh, and fish (dog --generate-completion-script zsh). The install script and Homebrew set this up for you; for the other methods, Shell completions walks through the one-time install for your shell.

Advanced

Everything below goes through the repo's Makefile. The targets you'll use:

sh
make build      # compiles an optimized binary for the machine you're on
make install    # copies the last built binary (see below)
make uninstall  # delete the installed binary
make help       # list every target

Two of them take an optional argument: make install PREFIX=<dir> changes where the binary goes, and make build TRAITS=<languages> builds a subset of languages — both explained below.

When to run what

You must run make build first, then make install — install doesn't build for you, deliberately, so sudo never touches the build files. To update after pulling new code, run both again.

Install location

make install copies the binary into /usr/local/bin, asking for sudo only when it has to. To skip sudo entirely, install into your home directory:

sh
make install PREFIX=~/.local

This assumes ~/.local/bin is on your PATH already.

Custom language builds

Every language in dog is a Swift package trait — like a Cargo feature in Rust: a grammar is only compiled in when its trait is on. The default build turns all 17 on, and released binaries always ship the full set. Building from source, you can pick a subset, and the binary shrinks accordingly: on macOS, the full build is ~20 MB, a Swift+JSON-only build is ~5 MB.

sh
make build TRAITS=SwiftLib,JSONLib && make install

Trait names follow the pattern <Language>Lib:

  • BashLib
  • CLib
  • CppLib
  • CSSLib
  • GoLib
  • HTMLLib
  • JavaScriptLib
  • JSONLib
  • LuaLib
  • MarkdownLib
  • PythonLib
  • RubyLib
  • RustLib
  • SwiftLib
  • TSXLib
  • TypeScriptLib
  • YAMLLib

WARNING

Files of a language you left out error with unknown language — they don't fall back to plain text the way genuinely unknown file types do.