Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac m1 安装protoc报错 #153

Open
cjhlai opened this issue Sep 28, 2022 · 2 comments
Open

mac m1 安装protoc报错 #153

cjhlai opened this issue Sep 28, 2022 · 2 comments

Comments

@cjhlai
Copy link

cjhlai commented Sep 28, 2022

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip
unzip protoc-3.14.0-linux-x86_64.zip
mv bin/protoc /usr/local/bin/

mac 64位的电脑,按上述步骤安装完protoc
在执行 goctl rpc protoc transform.proto --go_out=./pb --go-grpc_out=./pb --zrpc_out=.后,报错:sh: /usr/local/bin/protoc: cannot execute binary file
看了下, /usr/local/bin/protoc文件确实有的
应该怎么源码安装呀

@Peanut-5
Copy link

Peanut-5 commented Nov 2, 2022

M1 怎么能用x86_64编译的文件呢 如果不是在liunx虚拟机里面应该切换到osx才可以

@svott03
Copy link

svott03 commented Dec 28, 2022

I had the same problem running protoc binaries. I followed this link:
https://stackoverflow.com/questions/57700860/error-protoc-gen-go-program-not-found-or-is-not-executable

First install the Protocol Buffer Compiler Installation.
Run: $ brew install protobuf

Then execute:
$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Go install directs binaries to $GOPATH/bin/. Add this to your path variable to be able to execute the proper binaries. I did this by adding the following to my ~/.zshrc file:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants