Sometimes you need to switch homebrew package versions.
For example, due to this issue with imagemagick:
This installation of RMagick was configured with ImageMagick 6.8.9 but ImageMagick 6.9.0-9 is in use.
Clone homebrew repo and find commit with necessary version in git log (mine was 1e30cbf
for imagemagick 6.8.9-1)
git clone [email protected]:Homebrew/homebrew.git
cd homebrew
git log Library/Formula/imagemagick.rb
brew unlink imagemagick
brew install https://raw.githubusercontent.com/Homebrew/homebrew/1e30cbf/Library/Formula/imagemagick.rb
brew switch 6.8.9-1