下载 swoole最新版


https://pecl.php.net/package/swoole

sudo /opt/homebrew/Cellar/php@7.3/7.3.32/bin/phpize

sudo ./configure --with-php-config=/opt/homebrew/Cellar/php@7.3/7.3.32/bin/php-config

sudo make

遇到问题

'pcre2.h' file not found


ln -s /opt/homebrew/include/pcre2.h /opt/homebrew/Cellar/php@7.3/7.3.32/include/php/ext/pcre/pcre2.h

再次sudo make

又报错

linker command failed with exit code 1 (use -v to see invocation)

降低swoole版本到 4.8.3

sudo make install

sudo make test

修改php.ini


sudo vim /opt/homebrew/etc/php/7.3/php.ini 

添加

extension=swoole.so

重启php


 brew services restart php@7.3

查看phpinfo

Mac m1 安装 swoole_.net