How To Install Protoc?

How To Install Protoc?

protoc

Parse Google Protobuf `.proto` files and generate output in the specified language.

Maintainer: Laszlo Boszormenyi (GCS)



Section: devel

Install protoc

  • Debian apt-get install protobuf-compiler Click to copy
  • Ubuntu apt-get install protobuf-compiler Click to copy
  • Alpine OS apk add protobuf Click to copy
  • Arch Linux pacman -S protobuf Click to copy
  • Kali Linux apt-get install protobuf-compiler Click to copy
  • CentOS yum install protobuf-compiler Click to copy
  • Fedora dnf install protobuf-compiler Click to copy
  • Raspbian apt-get install protobuf-compiler Click to copy
  • macOS brew install protobuf Click to copy

Parse Google Protobuf `.proto` files and generate output in the specified language.

How to use protoc?

Below are few example commands for protoc that you can use in the terminal.

Generate Python code from a `.proto` file:
protoc --python_out=path/to/output_directory input_file.protoClick to copy
Generate Java code from a `.proto` file that imports other `.proto` files:
protoc --java_out=path/to/output_directory --proto_path=path/to/import_search_path input_file.protoClick to copy
Generate code for multiple languages:
protoc --csharp_out=path/to/c#_output_directory --js_out=path/to/js_output_directory input_file.protoClick to copy
Installation of latest protoc command is available for Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian and macOS. You can copy the command for your OS from above and paste it into your terminal. Once you run the command it will download the 2024 latest package from the repository and install it in your computer/server.