For most users the simplest approach is to download a pre-built binary.
1
Download a pre-built binary
Go to the protobuf releases page and download the zip package for your platform. The file is named protoc-$VERSION-$PLATFORM.zip and contains the protoc binary plus the standard .proto files distributed with protobuf.
Linux
macOS
Windows
# Download the latest release (replace VERSION and ARCH as appropriate)curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip# Unzip into a local directoryunzip protoc-$VERSION-linux-x86_64.zip -d $HOME/.local# Ensure the binary is on your PATHexport PATH="$PATH:$HOME/.local/bin"
Verify the installation:
protoc --version
Install via Homebrew:
brew install protobuf
Or download the pre-built binary manually:
# Download the latest releasecurl -LO https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/protoc-$VERSION-osx-aarch_64.zip# Unzip into a local directoryunzip protoc-$VERSION-osx-aarch_64.zip -d $HOME/.localexport PATH="$PATH:$HOME/.local/bin"
For Intel Macs use protoc-$VERSION-osx-x86_64.zip.Verify the installation:
protoc --version
Download protoc-$VERSION-win64.zip from the releases page and extract it. Add the bin directory to your PATH environment variable.Alternatively, install via vcpkg:
vcpkg install protobuf protobuf:x64-windows
Verify the installation:
protoc --version
2
Verify the installation
Run the following command to confirm protoc is installed and on your PATH:
protoc --version# libprotoc 28.x
If you need to use the latest unreleased version from the main branch, or you are working in C++ and need to build the library as part of your own project, see the Building from source section below.
The protobuf package on PyPI includes both a source distribution and binary wheels. The default backend is the upb C extension, which offers the best performance. A pure-Python fallback is available automatically if the C extension cannot be loaded.
pip install protobuf
To check which backend is in use:
from google.protobuf.internal import api_implementationprint(api_implementation.Type())# upb
Build from source if you need the latest unreleased version, want to modify the compiler, or are integrating protobuf as a C++ library in your own project.
1
Install build dependencies
You need Bazel, Git, g++, and Abseil.
Ubuntu/Debian
macOS
Windows
sudo apt-get install g++ git bazel
Install Xcode command-line tools first:
sudo xcode-select --install
Then install Bazel via Homebrew:
brew install bazel
Build using CMake with Visual Studio or Cygwin. See the CMake build instructions for details.Alternatively, use vcpkg: