Skip to content

Instantly share code, notes, and snippets.

@oleg-koval
Created September 2, 2019 15:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleg-koval/1692a517564a274400723afdbd68d78d to your computer and use it in GitHub Desktop.
Save oleg-koval/1692a517564a274400723afdbd68d78d to your computer and use it in GitHub Desktop.
Install protobuf (protoc) compiler OSX, Ubuntu

If you have Homebrew (which you can get from https://brew.sh), just run:

brew install protobuf

or

PROTOC_VERSION=3.9.1
PROTOC_ZIP=protobuf-all-${PROTOC_VERSION}.zip

curl -OL https://github.com/google/protobuf/releases/download/$PROTOC_VERSION/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local include/*
rm -f $PROTOC_ZIP
#!/usr/bin/env bash
PROTOC_VERSION=3.9.1
PROTOC_ZIP=protobuf-all-${PROTOC_VERSION}.zip
set -e # exit immediately on error
set -x # display all commands
sudo \
apt-get install \
autoconf \
automake \
libtool \
curl \
make \
g++ \
unzip
curl \
-OL \
https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}
# unzi[
sudo unzip -o $PROTOC_ZIP -d .
cd protobuf-${PROTOC_VERSION}
sudo ./configure
sudo make
sudo make check
sudo make install
# refresh shared library cache.
sudo ldconfig
# cleanup
rm -f $PROTOC_ZIP
# validate
protobuf --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment