Installing and Setting Up gRPC
1. Installing gRPC Runtime
| Language | Install Command | Latest (2026) |
|---|---|---|
| Go | go get google.golang.org/grpc@latest | v1.65+ |
| Java | Maven/Gradle io.grpc:grpc-netty | 1.64+ |
| Python | pip install grpcio grpcio-tools | 1.65+ |
| Node.js | npm install @grpc/grpc-js | 1.10+ |
| C++ | vcpkg/cmake build | 1.65+ |
| .NET | dotnet add package Grpc.AspNetCore | 2.65+ |
2. Installing Protocol Buffer Compiler
| OS | Command |
|---|---|
| macOS | brew install protobuf |
| Ubuntu/Debian | apt install -y protobuf-compiler |
| Windows | choco install protoc |
| Manual | Download from github.com/protocolbuffers/protobuf/releases |
| Verify | protoc --version → libprotoc 27.x+ |
3. Installing Language-Specific Plugins
| Language | Plugin Install |
|---|---|
| Go | go install google.golang.org/protobuf/cmd/protoc-gen-go@latestgo install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest |
| Python | Bundled in grpcio-tools (python -m grpc_tools.protoc) |
| Java | Gradle/Maven plugin protobuf-gradle-plugin |
| Node.js | npm i -D grpc-tools ts-proto |
| C# | Bundled with Grpc.Tools NuGet |
4. Setting Up Project Structure
my-service/
├── proto/
│ └── user/v1/user.proto
├── gen/
│ └── user/v1/ ← generated code
├── cmd/server/main.go
├── cmd/client/main.go
├── internal/service/user.go
├── buf.yaml
├── buf.gen.yaml
└── go.mod
5. Configuring Go Modules
Example: go.mod for a gRPC service
module example.com/user-service
go 1.22
require (
google.golang.org/grpc v1.65.0
google.golang.org/protobuf v1.34.2
)
| Setting | Purpose |
|---|---|
option go_package | Required in .proto to set import path |
replace | Use during local plugin development |
6. Verifying Installation
| Check | Command | Expected |
|---|---|---|
| protoc | protoc --version | libprotoc 27.x |
| Go plugin | which protoc-gen-go | Path in $GOBIN |
| gRPC plugin | which protoc-gen-go-grpc | Path in $GOBIN |
| buf | buf --version | 1.30+ |
7. Setting Up IDE Support
| IDE | Plugin |
|---|---|
| VS Code | Buf / vscode-proto3 / vscode-go |
| IntelliJ/GoLand | Protocol Buffers (bundled) |
| Vim/Neovim | vim-protobuf |
8. Configuring Environment Variables
| Variable | Purpose |
|---|---|
PATH | Must include $GOBIN or $GOPATH/bin |
GRPC_GO_LOG_VERBOSITY_LEVEL | 99 = verbose client logs (Go) |
GRPC_GO_LOG_SEVERITY_LEVEL | info | warning | error |
GRPC_TRACE | Comma-separated tracers (C-core) |
GRPC_VERBOSITY | DEBUG | INFO | ERROR |
9. Installing Development Tools
| Tool | Install | Purpose |
|---|---|---|
| grpcurl | brew install grpcurl | CLI client |
| ghz | brew install ghz | Load testing |
| Evans | brew install evans | Interactive REPL |
| grpc-gateway | go install .../protoc-gen-grpc-gateway@latest | REST gateway |
10. Setting Up Buf CLI
Example: buf.yaml + buf.gen.yaml
# buf.yaml
version: v2
modules:
- path: proto
lint:
use: [STANDARD]
breaking:
use: [FILE]
# buf.gen.yaml
version: v2
plugins:
- remote: buf.build/protocolbuffers/go
out: gen
opt: paths=source_relative
- remote: buf.build/grpc/go
out: gen
opt: paths=source_relative
| Command | Purpose |
|---|---|
buf lint | Style + best-practice linting |
buf breaking | Detect breaking changes vs base |
buf generate | Run codegen plugins |
buf build | Compile to FileDescriptorSet |