Open In App

How to Install Protobuf Compiler in MacOS?

Protocol Buffers (Protobuf) is a language-neutral, platform-neutral extensible mechanism for serializing structured data so that it can be transmitted over a wire or stored in files and it was developed by Google in 2008. They are faster than JSON and XML because they transfer data in binary format which improves the speed of transmission and takes less space and bandwidth. There are many ways to install it but for the sake of simplicity, we’ll install it using Homebrew package manager for MacOS.

Installation of Protobuf Compiler

To install the Protobuf compiler we need a brew package manager so let’s install it. Follow the below steps to install it on MacOS.



Step 1: Install the brew package manager (If you already have this, you can skip this step)

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



 

Here set the password then the installation will complete.

 

Step 2: Add it to PATH (Brew itself provides these commands in the Next steps section as shown in above image)

$ (echo; echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”‘) >> /Users/anurag/.zprofile

  eval “$(/opt/homebrew/bin/brew shellenv)”

Step 3: Now you can verify the brew installation

$ brew –version

 

At this point, the installation of the brew package manager is successful. Now install the Protobuf compiler. 

Step 4: Now you need to install the Protobuf compiler.

$ brew install protobuf

 

Step 5: Let’s verify the Protobuf compiler installation.

$ protoc –version

 

As you can see above we’ve successfully installed the Protobuf compiler. That’s it for now.

Article Tags :