Install grpccurl in Ubuntu

Prince Pereira
1 min readJan 29, 2021

--

grpcurl is a command-line tool that lets you interact with gRPC servers. It’s basically curl for gRPC servers.

The main purpose for this tool is to invoke RPC methods on a gRPC server from the command-line.

Ref: https://github.com/fullstorydev/grpcurl

Environment: Ubuntu 16.04, Server Edition

Install go

wget https://golang.org/dl/go1.14.6.linux-amd64.tar.gzsudo tar -C /usr/local -xzf go1.14.6.linux-amd64.tar.gzmkdir -p $HOME/GoProjects/src -p $HOME/GoProjects/pkg -p $HOME/GoProjects/binecho "export PATH=$PATH:/usr/local/go/bin:$HOME/GoProjects/bin" >> $HOME/.bashrcecho "export GOPATH=$HOME/GoProjects" >> $HOME/.bashrc && source $HOME/.bashrc

Install grpccurl

go get github.com/fullstorydev/grpcurl/...go install github.com/fullstorydev/grpcurl/cmd/grpcurl

How to use it

$ grpcurl -help$ grpcurl grpc.server.com:443 my.custom.server.Service/Method

# no TLS
$ grpcurl -plaintext grpc.server.com:80 my.custom.server.Service/Method
$ grpcurl -d '{"id": 1234, "tags": ["foo","bar"]}' \
grpc.server.com:443 my.custom.server.Service/Method
$ grpcurl -d @ grpc.server.com:443 my.custom.server.Service/Method <<EOM
{
"id": 1234,
"tags": [
"foor",
"bar"
]
}
EOM

Listing Services

$ # Server supports reflection
grpcurl localhost:8787 list

# Using compiled protoset files
grpcurl -protoset my-protos.bin list

# Using proto sources
grpcurl -import-path ../protos -proto my-stuff.proto list
The "list" verb also lets you see all methods in a particular service:
$ grpcurl localhost:8787 list my.custom.server.Service

Describing Elements

# Server supports reflection
$ grpcurl localhost:8787 describe my.custom.server.Service.MethodOne

# Using compiled protoset files
grpcurl -protoset my-protos.bin describe $ my.custom.server.Service.MethodOne

# Using proto sources
$ grpcurl -import-path ../protos -proto my-stuff.proto describe my.custom.server.Service.MethodOne

--

--

Prince Pereira
Prince Pereira

Written by Prince Pereira

Senior Software Engineer - Microsoft | SDN | Java | Golang | DS & Algo | Microservices | Kubernetes | Docker | gRPC & Protocol Buffer