Whenever I upgrade PHP, I seem to have troubles installing imagick. This command
pecl install imagick
always results in an error “‘pcre2.h’ file not found”.
To fix that error, you should issue these commands:
brew install pcre2
ln -s /opt/homebrew/Cellar/pcre2/10.39/include/pcre2.h /opt/homebrew/Cellar/php/8.1.0_1/include/php/ext/pcre/pcre2.h
You should probably replace the version numbers in that second command. Find out the version numbers by cd’ing into the /opt/homebrew/Cellar/pcre2/ and /opt/homebrew/Cellar/php/ directories.