Homebrew and ImageMagick

WordPress has a wonderful new plugin called Site Health. It does a great job letting you know what issues need to be repaired in order to have a healthy WordPress install.

One issue I had trouble solving was the message I kept getting saying that “imagick” was not available. I found a few links that addressed the issues with older versions of PHP but none that helped complete the update with the current version (which is 8.0 at the time of this posting).

First, I’ll go over what setup I currently have. Then, I’ll explain in detail what I did to successfully get Imagick working.

My Setup

I run WordPress 6.1.1 on a 2018 MacBook Pro running MacOS Ventura 13.0.1. To keep the server up-to-date, I use Homebrew. I’ve used this to install Apache, PHP, MariaDB, and other modules (the big 3 listed below):

  • Apache/2.4.54 (Unix)
  • 10.9.4-MariaDB Homebrew
  • PHP 8.0.25

Install ImageMagick

Use the following commands to install ImageMagick as requested by WordPress:

brew install imagemagick
brew install pkg-config
pecl install imagick

If all goes well, you should see something similar to this:

Build process completed successfully
Installing '/usr/local/Cellar/php@8.0/8.0.25/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/Cellar/php@8.0/8.0.25/pecl/20200930/imagick.so'
install ok: channel://pecl.php.net/imagick-3.7.0
Extension imagick enabled in php.ini

The last line means that the line extension="imagick.so" was added to the top of your php.ini file. Take note of the location of “imagick.so” (above on line 3, it’s the /usr/local/Cellar/php@8.0/8.0.25/pecl/20200930/imagick.so bit).


There is one error I used to get. I’m documenting it here in case anyone experiences this as well. An example is displayed below:

Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/lib/php/pecl/20180731/imagick.so (dlopen(/usr/local/lib/php/pecl/20180731/imagick.so, 9): image not found), /usr/local/lib/php/pecl/20180731/imagick.so.so (dlopen(/usr/local/lib/php/pecl/20180731/imagick.so.so, 9): image not found)) in Unknown on line 0

What worked for me was updating the extension location within the php.ini file.

For my install, the php.ini file is here:


Go to that directory:

cd /usr/local/etc/php/8.0

Open the php.ini file:

sudo nano php.ini

Find this line:


Change it to this (copy/paste the imagick.so location from the install confirmation above):


Save your changes and restart everything:

brew services restart --all
sudo apachectl restart

Check the Install

Lastly, go to Terminal and enter this command to check that imagick is connected to php:

php -m | grep -i magic

The result should be:


Once I completed these steps, the nag message from within Site Health disappeared! ImageMagick was connected and working as it should.

I hope this works for you. If you need further help, feel free to comment below. Thanks!

Leave a Reply