Homebrew is a great way to get unixy software on your Mac. The default install is to /usr/local, and it fixes the directory permissions so you don’t sudo every time. Every so often, however, the permissions can get a little mangled, usually from some other overzealous installer.
This quick fix is just a small modification to the standard Homebrew installer, removing the parts that actually do the installing: Running this command should fix your Homebrew /usr/local install in no time.
ruby -e "$(curl -fsSL https://gist.github.com/raw/768518/fix_homebrew.rb)"