I would like to install the older version of Google Protocol Buffers (protobuf-2.4.1) on Mac using the command line/Terminal app.
I tried with brew install protobuf
, but the latest version 2.5.0 has been installed.
Is it possible to install the older version from the terminal?
After you moved protoc file to /usr/local/bin check its permissions as simple as ls -la /usr/local/bin and look for that protoc file. Probably you want to do sudo chown root:root /usr/local/bin/protoc . UPDATE: Same applies to /usr/local/include/google/protobuf/* if you are using gRPC.
What are protocol buffers? Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.
protoc is a compiler for protocol buffers definitions files. It can can generate C++, Java and Python source code for the classes defined in PROTO_FILE.
There are some issues with building protobuf 2.4.1 from source on a Mac. There is a patch that also has to be applied. All this is contained within the homebrew protobuf241 formula, so I would advise using it.
To install protocol buffer version 2.4.1 type the following into a terminal:
brew tap homebrew/versions brew install protobuf241
If you already have a protocol buffer version that you tried to install from source, you can type the following into a terminal to have the source code overwritten by the homebrew version:
brew link --force --overwrite protobuf241
Check that you now have the correct version installed by typing:
protoc --version
It should display 2.4.1
This is not via brew, but the end result is the same.
Steps 4-7 are from the README.txt file from the protobuf tarball.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With