Open In App

How to Install Protobuf Compiler in MacOS?

Last Updated : 14 Jun, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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)”

Install the brew package manager

 

Here set the password then the installation will complete.

installation successful

 

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

verify the brew installation

 

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

install the Protobuf compiler.

 

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

$ protoc –version

verify the Protobuf compiler

 

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads