To install imagemagic using brew, please follow these simple steps:

Open the terminal and run these commands (one after another):

                    brew install php
brew install imagemagick
brew install pkg-config
sudo pecl install imagick
                  

NOTE: if you already have php installed, you can skip first step.