Install Swoole




brew install pcre2

Check versions

ls /opt/homebrew/Cellar/pcre2/
ls /opt/homebrew/Cellar/php/

Change below command versions

ln -s /opt/homebrew/Cellar/pcre2/10.42/include/pcre2.h /opt/homebrew/Cellar/php/8.2.2/include/php/ext/pcre/pcre2.h

Install with default options

pecl install swoole


Install with all options

pecl install swoole

Find php.ini file

php -i | grep php.ini

Enable extension in php.ini (around line 900). Change PHP version if needed.

sudo vim /etc/php/8.2/cli/php.ini
php -i | grep php.ini                      # check the php.ini file location
sudo echo "" >> php.ini  # add the to the end of php.ini
php -m | grep swoole                       # check if the swoole extension has been enabled
Table of Contents