先安装librdkafka
brew install librdkafka
如果报错 'pcre2.h' file not
执行下面命令,注意修改PHP地址
ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/Cellar/php@7.4/7.4.33_2/include/php/ext/pcre/pcre2.h
然后执行pecl install rdkafka
librdkafka 路径填写 /opt/homebrew/opt/librdkafka