Coding⏱️ 4 min read📅 2026-06-04

How to Fix: Error "protoc-gen-go: program not found or is not executable"

Troubleshoot the error "protoc-gen-go: program not found or is not executable" when building a Go application with gRPC.

Quick Answer: Check if the 'protoc' compiler and its dependencies are properly installed and configured on your system, and set the PATH environment variable to include the directory containing the 'protoc' executable.

Error "protoc-gen-go: program not found or is not executable" occurs when the protoc-gen-go tool, which is responsible for generating the Go code from the protocol buffer definition file (proto file), cannot be located by the system. This issue affects developers who are using gRPC with Go to build and deploy their applications.

This error typically happens when the protoc-gen-go tool or its dependencies are not installed correctly, or the PATH environment variable is not set properly to include the location of the tool.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the protoc-gen-go tool is not installed or is not executable. To resolve this issue, ensure that you have installed the required Go packages using the following commands: go get -u google.golang.org/grpc and go get -u github.com/golang/protobuf/protoc-gen-go.
  • Another potential cause of this error is a misconfigured PATH environment variable. Check if the protoc-gen-go tool is in your system's PATH by running the command 'which protoc-gen-go' in your terminal. If it is not found, you need to add the location where the tool is installed to your PATH.

🛠️ Step-by-Step Verified Fixes

Fixing the Error

  1. Step 1: Verify that the Go packages are correctly installed by running the commands go get -u google.golang.org/grpc and go get -u github.com/golang/protobuf/protoc-gen-go in your terminal.
  2. Step 2: Check if the protoc-gen-go tool is executable by running the command 'file /usr/bin/protoc-gen-go' (assuming it's installed at this location). If it's not executable, you need to add execute permissions using the command 'chmod +x /usr/bin/protoc-gen-go'.
  3. Step 3: Set the PATH environment variable correctly to include the location of the protoc-gen-go tool. You can do this by adding the following line to your shell configuration file (~/.bashrc or ~/.zshrc): export PATH=$PATH:/usr/bin

Alternative Fix

  1. Step 1: If you're using a package manager like Homebrew, you can install the required packages using the following commands: brew install grpc and brew install protobuf.
  2. Step 2: Alternatively, you can try installing the protoc-gen-go tool manually by downloading it from the official GitHub repository or by building it from source. However, this method is not recommended as it requires more technical expertise.

✨ Wrapping Up

To resolve the Error "protoc-gen-go: program not found or is not executable", follow these steps: Verify that the required Go packages are installed correctly, check if the protoc-gen-go tool is executable and set the PATH environment variable correctly. If you're still experiencing issues, consider using alternative methods to install the required packages.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions