Created
April 24, 2025 15:42
-
-
Save ruz/c23b7d5e8240e0c708475c45b3a7147e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
VERSION=29.3 | |
# NOTE: this script: | |
# - expects that $HOME/bin exists and is part of $PATH, it's on you | |
# - *removes* old protoc from the directory first | |
# - expects *MacOS* and *ARM64* architecture | |
# remove old protoc | |
rm -rf $HOME/bin/protoc $HOME/bin/protoc-bin $HOME/bin/protoc-include | |
FILE=protoc-$VERSION-osx-aarch_64.zip | |
TMPDIR=protoc-tmp | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v$VERSION/$FILE | |
unzip $FILE -d $TMPDIR | |
mv $TMPDIR/bin/protoc $HOME/bin/protoc-bin | |
mv $TMPDIR/include/ $HOME/bin/protoc-include/ | |
chmod +x $HOME/bin/protoc-bin | |
# write a wrapper script | |
cat <<EOF > $HOME/bin/protoc | |
#!/bin/sh | |
$HOME/bin/protoc-bin -I $HOME/bin/protoc-include "\$@" | |
EOF | |
chmod +x $HOME/bin/protoc | |
rm -rf $TMPDIR | |
rm $FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment