How to install gRPC extension on your MAC computer?
There is couple of steps you would need to perform, in this tutorial we will go one by one.

 

If you are not familiar with gRPC, please read official documentation about it:

 

Check do you have it already, type this in your terminal window

                    php -m
                  

in the printed list check do you have grpc module, if not try to install it with this command:

                    sudo pecl install grpc

                  

and if you get this error: Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script. 

                    Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed

                  

we would have to first fix autoconf issue.

Here is the lists of commands to install it: 

go to your project folder and grab it with curl:

                    curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
                  

extract it and make it:

                    tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
                  

if you get this error xcrun: error: invalid active developer path you would have to download and install the Command Line Tools package and fix the problem:

                    xcode-select --install
                  

After that you could get this popup:

Accept it and wait until it is installed

Now run this command again (note: you should be in cd autoconf-* folder still) :

                    ./configure --prefix=/usr/local
                  

and then run make command

                    make
                  

and then 

                    sudo make install
                  

ok, now we can run again sudo pecl install grpc to finally install gRPC extension:

                    sudo pecl install grpc
                  

this will take some time, so go and drink a ☕️ and wait until is finished...

...

OK, now when it is finished you should see this message:

                    Build process completed successfully
Installing '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20180731/grpc.so'
install ok: channel://pecl.php.net/grpc-1.35.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=grpc.so" to php.ini

                  

And now we have to enable it in our php.ini

To locate your php ini file, type this:

                     php -i | grep 'Configuration File'
                  

in my case, location is:

                    Loaded Configuration File => /usr/local/php5/lib/php.ini
                  

so let's add our grpc.so to it:

login as admin:

                    sudo nano 
                  

add php extension by using the command line:

                    echo "extension=grpc.so" >> /usr/local/php5/lib/php.ini
                  

restart the apache

                    apachectl restart
                  

cool, now if you type php - m you should see grpc in your list of enabled modules.

easy peasy lemon squeezy 😀