Prerequisites

Make sure you have Homebrew:

1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow Saurabh Bajaj’s Homebrew setup guide for a complete Mac dev environment setup.

Add Homebrew to your path by adding this to ~/.zshrc and ~/.bash_profile:

1
PATH="/usr/local/bin:$PATH"

Install Protobuf from Source

Restart your terminal instance and run:

1
2
3
4
5
6
7
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
brew install autoconf automake libtool
autoreconf -i
./configure --prefix=/opt/usr/local
make
make install

Final Configuration

Add this to your ~/.zshrc too:

1
PATH=/opt/usr/local/bin:$PATH

Restart your terminal and verify the installation with protoc --version.