Search code examples
protocol-buffershomebrew

Installing Google Protocol Buffers on mac


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?


Solution

  • 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