Skip to main content

Installation

Homebrew#

buf can be installed for Mac or Linux using Homebrew via the bufbuild/homebrew-buf tap.

brew tap bufbuild/bufbrew install buf

This will install the following:

  • The binaries buf, protoc-gen-buf-breaking, protoc-gen-buf-lint.
  • Bash completion for buf.
  • Fish completion for buf.
  • Zsh completion for buf.

GitHub Releases#

buf is released via the bufbuild/buf repository.

Two types of assets are available:

  • The single buf, protoc-gen-buf-breaking, and protoc-gen-buf-lint binaries.
  • A tarball containing the binaries, bash completion, fish completion, and zsh completion.

See the Releases page for the current release.

Binary#

The binary is all that is needed to get started.

To install just the buf, protoc-gen-buf-breaking, or protoc-gen-buf-lint binaries to /usr/local/bin for version 1.0.0-rc6:

# Substitute BIN for your bin directory.# Substitute VERSION for the current released version.# Substitute BINARY_NAME for "buf", "protoc-gen-buf-breaking", or "protoc-gen-buf-lint".BIN="/usr/local/bin" && \VERSION="1.0.0-rc6" && \BINARY_NAME="buf" && \  curl -sSL \    "https://github.com/bufbuild/buf/releases/download/v${VERSION}/${BINARY_NAME}-$(uname -s)-$(uname -m)" \    -o "${BIN}/${BINARY_NAME}" && \  chmod +x "${BIN}/${BINARY_NAME}"

/usr/local/bin should be on your $PATH.

To uninstall from /usr/local/bin:

# Substitute BIN for your bin directory.# Substitute BINARY_NAME for "buf", "protoc-gen-buf-breaking", or "protoc-gen-buf-lint".BIN="/usr/local/bin" && \BINARY_NAME="buf" && \  rm -f "${BIN}/${BINARY_NAME}"

Tarball#

To install the buf, protoc-gen-buf-breaking, and protoc-gen-buf-lint binaries, bash completion, fish completion, and zsh completion to /usr/local for version 1.0.0-rc6:

# Substitute PREFIX for your install prefix.# Substitute VERSION for the current released version.PREFIX="/usr/local" && \VERSION="1.0.0-rc6" && \  curl -sSL \    "https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-$(uname -s)-$(uname -m).tar.gz" | \    tar -xvzf - -C "${PREFIX}" --strip-components 1

The binaries will be installed to /usr/local/bin, which should be on your $PATH.

To uninstall from /usr/local:

# Substitute PREFIX for your install prefix.PREFIX="/usr/local" && \rm -f \  "${PREFIX}/bin/buf" \  "${PREFIX}/bin/protoc-gen-buf-breaking" \  "${PREFIX}/bin/protoc-gen-buf-lint" \  "${PREFIX}/etc/bash_completion.d/buf" \  "${PREFIX}/etc/fish/vendor_completions.d/buf.fish"  "${PREFIX}/etc/zsh/site-functions/_buf"

Verifying a release#

Releases are signed using our minisign public key:

RWQ/i9xseZwBVE7pEniCNjlNOeeyp4BQgdZDLQcAohxEAH5Uj5DEKjv6

The release assets can be verified using the following (assuming minisign is installed):

# Substitute VERSION for the current released version.VERSION="1.0.0-rc6" && \  curl -OL https://github.com/bufbuild/buf/releases/download/v${VERSION}/sha256.txt && \  curl -OL https://github.com/bufbuild/buf/releases/download/v${VERSION}/sha256.txt.minisig && \  minisign -Vm sha256.txt -P RWQ/i9xseZwBVE7pEniCNjlNOeeyp4BQgdZDLQcAohxEAH5Uj5DEKjv6

From Source#

The binaries can be installed from source if go is installed, however we recommend using one of the release assets instead.

# Substitute GOBIN for your bin directory# Leave unset to default to $GOPATH/binGO111MODULE=on GOBIN=/usr/local/bin go get \  github.com/bufbuild/buf/cmd/buf \  github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking \  github.com/bufbuild/buf/cmd/protoc-gen-buf-lint

Use the Docker Image#

Buf ships a Docker image (bufbuild/buf) that allows you to use buf as part of your Docker workflow.

For example, you can run buf lint with the following command:

$ docker run --volume "$(pwd):/workspace" --workdir /workspace bufbuild/buf lintgoogle/type/datetime.proto:17:1:Package name "google.type" should be suffixed with a correctly formed version, such as "google.type.v1".

Windows Support#

Buf has officially added support for Windows, available for both x64_64 and arm64 architectures. You can download the latest binary from the release page.