Posts Learn Components Snippets Categories Tags Tools About

How to install Imagick on MacOS system

In this post you will learn how to install imagick on MacOs using Homebrew

3 years ago

5 mins read


In this post, I assume that everyone has already installed PHP with Homebrew. if you have not done so, do run the command below.
brew install php

Check if Imagick is already installed

Before starting do check whether Imagick is already installed in the system.
php -m | grep imagick
If the response is blank that would mean Imagick is not installed.

Install Imagick dependency

The first thing to do is to install the necessary dependency for the setup. Do note that it will take some time to install the necessary dependency.
brew install pkg-config imagemagick

Install Imagick through PECL

Once that's done, run the command below to install Imagick using PECL command line.
pecl search imagick
pecl install imagick
brew services restart php

Update: 16/6/2021

If you are using macOS M1 and PHP version 7 or 8 and having some issues, do run the command below one at a time. Do specify your own PHP version below otherwise, it won't be able to symlink the file.
# install pcre2
brew install pcre2

# symlink the required file
ln -ln -s /opt/homebrew/Cellar/pcre2/10.37/include/pcre2.h /opt/homebrew/Cellar/php/8.0.6_1/include/php/ext/pcre
Install Imagick directly from the source, make sure to run the command one line at a time.
git clone

cd imagick

phpize && ./configure


make test

make install
Once it's installed, edit your php.ini file and add the line extension="". Finally, restart your PHP with the command below.
brew services restart php

# or if using laravel valet
valet restart
By now you should have Imagick installed and you can test it by running the command above and get a response "imagick" in the terminal.

Alternative Tags

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for How to install Imagick on MacOS system