Homebrew and ImageMagick

How to properly install ImageMagick with Homebrew and PHP 7.3.8

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 7.3.8 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 5.2.2 on a Mac. To keep the server up-to-date, I use Homebrew. I’ve used Homebrew to install an updated version of Apache, PHP, MySQL, and various modules:

  • Apache/2.4.41 (Unix)
  • MySQL 8.0.17 Homebrew
  • PHP 7.3.8

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/7.3.8/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/Cellar/php/7.3.8/pecl/20180731/imagick.so'
install ok: channel://pecl.php.net/imagick-3.4.4
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). Unfortunately, I still received an error message:

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

The link I included above (fix for php 7.2) mentions adding an additional *.ini file with this imagick directory listed. However, that did not fix the issue for me. What worked for me was updating the extension location within the php.ini file.

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


Go to that directory:

cd /usr/local/etc/php/7.3

Open php.ini:

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

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!