Installing Protocol buffer compilers in Mac OS

Prasanna Aithal
Nuclei Technology Blog
1 min readDec 11, 2019

Today, i am going to explain how to install the required compiler in order to compile proto files with Swift Protocol Buffer Compiler.

First we need to download and install Google official Protocol Buffer Compiler which you can find here:

and download the mac os x compatible zip file and open terminal and execute the following command

$ unzip protoc-3-3-osx-x86_64.zip -d proto_buffer && cd proto_buffer
$ sudo cp bin/protoc /usr/local/bin
$ sudo cp -R include/google/protobuf/ /usr/local/include/google/protobuf

The above command will unzip the file and install the required exexcutable to the /usr/local/bin $PATH location inside your machine.

If application is written in Xcode using Swift, we also need Swift Protobuf Compiler. To do that execute the following command again in Terminal.

$ git clone https://github.com/grpc/grpc-swift.git
$ cd grpc-swift
$ git checkout tags/0.5.1
$ make
$ sudo cp protoc-gen-swift protoc-gen-swiftgrpc /usr/local/bin

That’s it. Once done you can check the executable here: /usr/local/bin. It will look like this

Happy coding!!!

--

--

Prasanna Aithal
Nuclei Technology Blog

iOS, Flutter, Svelte, PWA & WebAssembly Developer at Nuclei