'Swift gRPC program not found

Hi i want to use swift gRPC and install in my mac, i already install with homebrew but can't generate the plugins.

The error message is

protoc-gen-swiftgrpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable

The truth is i don't know how to put edit and add PATH in my ~/bash_profile

When i check in my terminal with

which protoc-gen-swift

it return

/opt/homebrew/bin/protoc-gen-swift

i already search the article but there is no swift solution in this problem. Please help me i'm desperate with it.



Solution 1:[1]

I found my solution, i think when it comes to swift grpc is hard to find the right tutorial. The problem i have is when i called protoc to generate in my terminal it failed to generate even though i have my plugin install.

There is a typo in this tutorial swift grpc

I just change the command from this

protoc --swiftgrpc_out=. MyProto.proto

to this

protoc --grpc-swift_out=. MyProto.proto

Solution 2:[2]

There is a typo in this tutorial swift grpc

Actually it seems that it is not a typo, but just a not-updated tutorial.

There are 2 versions of Swift GPRC plugins:

  • One of them is the old protoc-gen-swiftgrpc plugin.

  • And the other one is the new protoc-gen-grpc-swift plugin.

You can see more details here: https://github.com/grpc/grpc-swift#versions

Some tutorials use the old one.

That is why it shows program not found or is not executable error.

And additional explanatory message below that error

Please specify a program using absolute path or make sure the program is available in your PATH system variable

just makes it more difficult to notice, as it simply focuses on potential path issues.

So, to summarize, what you install and what you are trying to run are not the same plugin.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ferryawijayanto
Solution 2 erkanyildiz