Note: I\'m not so good at using shell.
I was trying to install Valgrind using brew on Yosemite.
Valgrind
brew
brew install --HEAD valgrind<
In my case, brew doctor got it right. At some point /usr/local/lib/pkgconfig was set to be owned by root rather than my account. The prescribed remedy worked -
sudo chown -R $(whoami) /usr/local/lib/pkgconfig