Skip to content

Instantly share code, notes, and snippets.

@ilyar
Created January 31, 2020 15:52
Show Gist options
  • Select an option

  • Save ilyar/b621e9ee299826cce6403ad1e4ce79af to your computer and use it in GitHub Desktop.

Select an option

Save ilyar/b621e9ee299826cce6403ad1e4ce79af to your computer and use it in GitHub Desktop.
Protocol Buffers Install
#!/bin/bash
TEMP_DIR=/tmp
VERSION=`curl --silent "https://api.github.com/repos/protocolbuffers/protobuf/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")'`
[[ -z VERSION ]] && echo "Could not get version from github"
mkdir $TEMP_DIR/protoc_inst
cd $TEMP_DIR/protoc_inst
# Make sure you grab the latest version
curl -OL "https://github.com/google/protobuf/releases/download/v$VERSION/protoc-$VERSION-linux-x86_64.zip"
# Unzip
unzip "protoc-$VERSION-linux-x86_64.zip" -d protoc
# Move protoc to /usr/local/bin/
sudo mv protoc/bin/* /usr/local/bin/
# Move protoc/include to /usr/local/include/
sudo mv protoc/include/* /usr/local/include/
rm -rf $TEMP_DIR/protoc_inst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment