Skip to content

Instantly share code, notes, and snippets.

@shengslogar
Created August 24, 2021 06:04
Show Gist options
  • Save shengslogar/82039ceb09b03f4b88aee45d21ae8ffe to your computer and use it in GitHub Desktop.
Save shengslogar/82039ceb09b03f4b88aee45d21ae8ffe to your computer and use it in GitHub Desktop.

Install Imagick on M1/Apple Silicon with Homebrew

If you're getting the following error after running pecl install imagick:

/opt/homebrew/Cellar/php@7.4/7.4.22/include/php/ext/pcre/php_pcre.h:25:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
         ^~~~~~~~~
1 error generated.
make: *** [imagick.lo] Error 1
ERROR: `make' failed
  1. Make sure pcre2 is installed: brew install pcre2
  2. Manually copy missing header file: cp /opt/homebrew/Cellar/pcre2/VERSION/include/pcre2.h /opt/homebrew/Cellar/php@VERSION/VERSION/include/php/ext/pcre
  3. Rerun pecl install imagick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment