Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Make sure you grab the latest version
curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip
# Unzip
unzip protoc-3.2.0-linux-x86_64.zip -d protoc3
# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/
# Move protoc3/include to /usr/local/include/
sudo mv protoc3/include/* /usr/local/include/
# Optional: change owner
sudo chwon [user] /usr/local/bin/protoc
sudo chwon -R [user] /usr/local/include/google
@dminGod

This comment has been minimized.

Copy link

commented May 1, 2017

Awesome! : )

@afcastano

This comment has been minimized.

Copy link

commented May 17, 2017

The problem with the last step is that the types like Timestamp are not loaded.
I did change the last step to:
ln -s /protoc3/bin/protoc /usr/bin/protoc

That fixed the problem!

@mathben

This comment has been minimized.

Copy link

commented May 25, 2017

@stevenferrer

This comment has been minimized.

Copy link

commented May 29, 2017

@afcastano, that means I still need to maintain the protoc3/bin/protoc file right? since deleting It would cause problems

@alecholmez

This comment has been minimized.

Copy link

commented Jun 12, 2017

Wait.. you can't symlink it if an earlier version of protoc exist.

@charan223

This comment has been minimized.

Copy link

commented Jun 21, 2017

you are awesome

@fisheess

This comment has been minimized.

Copy link

commented Jun 23, 2017

best solution on github!

@fractalDimension

This comment has been minimized.

Copy link

commented Jul 10, 2017

Thank you!

@imbur

This comment has been minimized.

Copy link

commented Aug 13, 2017

Thank you!
There are a typos in line 14 and line 15: chown is misspelled.

@jtavara23

This comment has been minimized.

Copy link

commented Aug 23, 2017

great!

@vCloudernBeer

This comment has been minimized.

Copy link

commented Sep 6, 2017

@afcastano which step you are referring to as the last step is changed to "ln -s /protoc3/bin/protoc /usr/bin/protoc". Seems like the last step is "sudo mv protoc3/include/* /usr/local/include/". Or you are adding this as the last step?

I followed the steps and did not encounter any problem. thanks for the information. :)

@rvegas

This comment has been minimized.

Copy link

commented Sep 19, 2017

@sofyanhadia You have a typo on:

# Optional: change owner
sudo chwon [user] /usr/local/bin/protoc
sudo chwon -R [user] /usr/local/include/google

Change chwon to chown 😏

@yurkazaytsev

This comment has been minimized.

Copy link

commented Oct 18, 2017

Thanks!

@bedge

This comment has been minimized.

Copy link

commented Nov 4, 2017

Latest is now https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-linux-x86_64.zip
Also, recommend 'stow' utility for managing non-packaged components.
e.g.:

 %> sudo stow -n cproto -D /usr/local -d /usr/local/stow
Loading defaults from /root/.stowrc
LINK: include/google => ../stow/cproto/include/google
LINK: readme.txt => stow/cproto/readme.txt
LINK: bin/protoc => ../stow/cproto/bin/protoc

Avoids the need to manually copy/link, plus manages what's been added in this manner for later removal/upgrade/etc.

@Arfey

This comment has been minimized.

Copy link

commented Dec 21, 2017

Thx

@aescart1

This comment has been minimized.

Copy link

commented Dec 30, 2017

great

@sailfish009

This comment has been minimized.

Copy link

commented Jan 20, 2018

thanks for the info!

@sleebapaul

This comment has been minimized.

Copy link

commented Mar 22, 2018

it is giving the following error -bash: /usr/local/bin/protoc: cannot execute binary file: Exec format error

@rahuldeo2047

This comment has been minimized.

Copy link

commented Apr 12, 2018

Just thought it might be useful to mates, stuck with multiple protobuf versions runtime issue:
protocolbuffers/protobuf#4001

So that we check if there is already a version installed.

@edwardmartinsjr

This comment has been minimized.

Copy link

commented Apr 30, 2018

Awesome!

@bigdataplot

This comment has been minimized.

Copy link

commented May 3, 2018

Fixed my problem :) Thx

@jeshan

This comment has been minimized.

Copy link

commented May 11, 2018

thanks. consider changing [user] to $USER to make it runnable immediately. also the "chwon" has already been reported above.

@xiadeye

This comment has been minimized.

Copy link

commented May 29, 2018

should add ln -s /usr/local/bin/protoc /usr/bin/protoc

@deepkshikha

This comment has been minimized.

Copy link

commented Jul 12, 2018

Thanks

@purusothaman2502

This comment has been minimized.

Copy link

commented Jul 15, 2018

redhat@redhat-HP-245-G5-Notebook-PC:~$ sudo chown [redhat] /usr/local/bin/protocchown: invalid user: ‘[redhat]’
how to solve this error?? ple help me :::))

@sushant1727

This comment has been minimized.

Copy link

commented Jul 19, 2018

@purusothaman2502 remove the [ ] for your user.

Command becomes sudo chown redhat /usr/local/bin/protocchown

@noshky

This comment has been minimized.

Copy link

commented Jul 20, 2018

How can I update the library too?
Cmake gives me:
Protobuf compiler version 3.3.0 doesn't match library version 3.0.0
(on ubuntu-bionic)

@Jomes

This comment has been minimized.

Copy link

commented Jul 25, 2018

Thank you!
There are a typos in line 14 and line 15: chown is misspelled.

@shriAG

This comment has been minimized.

Copy link

commented Jul 30, 2018

Hi How to install google protobuf along with protoc ?

@efazati

This comment has been minimized.

Copy link

commented Oct 28, 2018

Change chwon to chown

@Eddy-Morgan

This comment has been minimized.

Copy link

commented Nov 9, 2018

thanks . workeed

@biswajitAqb

This comment has been minimized.

Copy link

commented Nov 12, 2018

Awesome !! Worked.

@pmalhaire

This comment has been minimized.

Copy link

commented Nov 15, 2018

I added auto get version and made it work as a script file

#! /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 protoc3

# Move protoc to /usr/local/bin/
sudo mv protoc3/bin/* /usr/local/bin/

# Move protoc3/include to /usr/local/include/
sudo mv protoc3/include/* /usr/local/include/

rm -rf $TEMP_DIR/protoc_inst
@karlTUM

This comment has been minimized.

Copy link

commented Nov 15, 2018

How to solve the problem that is:

Protobuf compiler version 3.6.1 doesn't match library version 3.0.0?

Thank you.

@vboo27

This comment has been minimized.

Copy link

commented Nov 22, 2018

THX!

@sri-prasanna

This comment has been minimized.

Copy link

commented Jan 9, 2019

thanks

@hyperchris

This comment has been minimized.

Copy link

commented Feb 4, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.