$ brew install imagemagick@6
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).
No changes to formulae.
==> Downloading https://homebrew.bintray.com/bottles/imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
Already downloaded: /Users/watson/Library/Caches/Homebrew/imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
==> Pouring imagemagick@6-6.9.8-4.sierra.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
This is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/imagemagick@6/lib
CPPFLAGS: -I/usr/local/opt/imagemagick@6/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/imagemagick@6/lib/pkgconfig
==> Summary
/usr/local/Cellar/imagemagick@6/6.9.8-4: 1,469 files, 22.4MB
$ LDFLAGS="-L/usr/local/opt/imagemagick@6/lib" CFLAGS="-I/usr/local/opt/imagemagick@6/include" PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig" gem i rmagick
Building native extensions. This could take a while...
Successfully installed rmagick-2.16.0
1 gem installed