Skip to content

Install goctl

goctl (pronounced “go control”) is go-zero’s code-generation CLI. It reads .api and .proto files and produces complete, production-ready Go services — eliminating boilerplate.

Terminal window
go install github.com/zeromicro/go-zero/tools/goctl@latest
Terminal window
goctl --version
# goctl version 1.7.3 darwin/arm64

If you see command not found, your $GOBIN is not in PATH. Fix it:

Terminal window
# Add to ~/.zshrc or ~/.bashrc
export GOBIN=$(go env GOPATH)/bin
export PATH=$PATH:$GOBIN
source ~/.zshrc

Re-run the same install command to get the latest version:

Terminal window
go install github.com/zeromicro/go-zero/tools/goctl@latest
goctl --version
CommandOutput
goctl api new <name>Complete HTTP API service skeleton
goctl api go -api f.api -dir .Go code from an existing .api file
goctl rpc new <name>Complete gRPC service skeleton
goctl rpc protoc f.proto ...Go code from an existing .proto file
goctl model mysql ddl -src f.sql -dir .DB model layer from SQL schema
goctl docker -go main.goDockerfile
goctl kube deploy ...Kubernetes deployment manifest

For RPC services: Install protoc →

For HTTP-only services: Hello World →