在MacOS Mojave上安装ImageMagick PHP扩展时出错

I've looked into this answer ImageMagick Brew installation with PHP Module in Mac OS X but not able to install ImageMagick on MacOS Mojave. I'm stuck here:

sudo pear install imagick-3.1.1.tgz

gives error

checking if ImageMagick version is at least 6.2.4... found version 7.0.8 Q16 HDRI

configure: error: Cannot locate header file magick-wand.h

ERROR: `/private/tmp/pear/temp/imagick/configure --with-php-config=/usr/bin/php-config --with-imagick=7.0.8' failed

How to install it?