Use ImageMagick with Laravel Valet

If you want to use ImageMagick in combination with Laravel Valet, you need to install it first via Homebrew:

brew install imagemagick
pecl install imagick

Running pecl install imagick might result in this error message:

$ pecl install imagick
checking for pkg-config... no
pkg-config not found
configure: error: Please reinstall the pkg-config distribution
ERROR: `/private/tmp/pear/temp/imagick/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-imagick' failed

To resolve this issue, run the following command:

brew install pkg-config

Now, pecl install imagick should work:

pecl install imagick

Finally, restart Valet:

valet restart

ImageMagick should now be available for use.