Installing Imagick in Valet
Whenever I update to new versions of PHP in my local installation, I need to reinstall Imagick. Since I look up these steps every time, I’m documenting them here so future me can remember this.
Is Imagick really not installed?
First you might have it installed on your machine. Does this return a version number?
convert -version
If so, you have it installed but it might not be wired up for your PHP version. Check that out with this command.
php -i | grep Imagick
If you see references to Imagick, you’ve already got it installed and configured for PHP to use it. If not, let’s install it.
If you didn’t have Imagick installed at all, install it with Homebrew like this:
brew install imagemagick
Now the following should return a version number:
convert -version
You now have it but it’s not “hooked up” to your PHP installation. We use pecl
to do that.
pecl install imagick
Now you’ll need to restart Valet.
valet restart
Check your work
php -i | grep Imagick
Do you see references to Imagick? If so, you’ve done it.
Let the image magic begin.