Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ORIOLESFan02/67b5c93c8c2e95992703f2c2dbab1d3c to your computer and use it in GitHub Desktop.
Save ORIOLESFan02/67b5c93c8c2e95992703f2c2dbab1d3c to your computer and use it in GitHub Desktop.
An 'OfF-tOpIc' comment explaining how I solved a problem in https://github.com/Homebrew/homebrew-core/pull/133746 It took me 3 hours to solve the problem, 3 hours to type everything out, 6 hours total, and it gets marked as off-topic within minutes of submitting. This gist file is meant for people who do not have a github account.

Edit: I am deeply saddened that this comment was marked as 'off-topic', but i'm not here to fight this. You do you I guess, and I hope you're happy that I wasted 3 hours of my life typing the guide below rather than doing something "productive." The point for this comment was for people who may have experienced a similar problem and wanted to solve it right away without having to wait for this 'issue' to be fixed. Whatever... I guess.

For protobuf, a way I figured out how to get it working (it took me over three hours to find a solution that worked for me) is to

  1. Download the latest version of protobuf (https://github.com/protocolbuffers/protobuf/releases/latest) for your machine [I chose v23.3 {as of the time of making this comment} osx x86_64, but make sure to choose the correct version for your machine.]
  2. Extract the file(s) and locate protoc using the command which protoc. Save that location for later.

2a. During the time this has been written, the version i was previously on was 21.12 which was located in /usr/local/Cellar/protobuf (Case Sensitive)

  1. Either using terminal, or Finder (assuming you're on MacOS), create a folder with the version that is available (for me, it's 23.3). Using Terminal, you can create the file by doing mkdir <version.number> (example: mkdir 23.3) in /usr/local/Cellar/protobuf/, or y'know, you can also use Finder using a couple clicks and your keyboard to accomplish the same task. Whichever way you prefer.

  2. Go back to the unzipped protobuf/protoc folder and copy everything to the new folder you created in /usr/local/Cellar/protobuf/

4a. You are now going to need to go to /usr/local/bin as we're going to remove protoc and protoc-3.<version.number>.0 (example old file: protoc-3.21.12.0)

  1. You're going to have to create a Symbolic Link,

5a. How I created the Symbolic Link was by doing this while in /usr/local/Cellar/protobuf/<version.number> (ex: .../protobuf/23.3): ln -s "$PWD/./protoc-3.<version.number>.0" protoc (example: ln -s "$PWD/./protoc-3.23.3.0" protoc)

5b. COPY (meaning leave the symbolic link in /usr/local/Cellar/protobuf/<version.number>/) protoc into /usr/local/bin/ (I would personally recommend putting the previous version of the protoc symbolic link from /usr/local/bin/ to the trash, but don't remove it in case you need it again)

5c. Create another symbolic link, this one for protoc-3.<version.number>.0. Create it in /usr/local/Cellar/protobuf/<version.number>, but how I did it was by doing ln -s "$PWD/./protoc-3.<version.number>.0" protoc-3.<version.number>. [example: ...Create it in /usr/local/Cellar/protobuf/23.3 ...was by doing ln -s "$PWD/./protoc-3.23.3.0" protoc-3.23.3.] (omitting the '0' at the end, or it wouldn't create the symbolic link.

5d. MOVE (NOT copy) protoc-3.<version.number>. to /usr/local/bin/ and then RENAME protoc-3.<version.number>. to protoc-3.<version.number>.0 (example: rename protoc-3.23.3. to protoc-3.23.3.0)

5e. After all of that, remove the previous protoc-3-<oldversion.number>.0 [example: protoc-3-21.12.0 (by that, i mean put it in the trash for right now in case you need it again)

  1. In the Terminal, I'd recommend opening another instance, just to be sure in case something goes wrong.

6a. While in that new Terminal instance (assuming you're in your user directory [if not, just type cd]), type protoc --version

6b. If protoc --version shows "libprotoc <latestversion.number>" (Example: "libprotoc 23.3", then you have successfully installed protobuf.

  1. I would now recommend running brew update and brew upgrade and you should no longer see anything about protobuf needing to be built and/or updated or whatever it does.

I am aware that this is pretty long, but this is the way that I solved it. I'm very positive that this could be condensed down A LOT more, but again, this is the way that I did it, and this is the way that it worked for me.

If anyone wants to modify the way I did it, and possibly make it easier to do and/or understand, please, be my guest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment