Brew doctor says: "Warning: /usr/local/include isn't writable."

Brew doctor says:

Warning: /usr/local/include isn't writable. This can happen if you "sudo make install" software that isn't managed by Homebrew.

If a brew tries to write a header file to this directory, the install will fail during the link step.

You should probably chown /usr/local/include

I've tried different commands to solve this but I'm still stuck here.

I'm running homebrew on 10.8.2


Take ownership of it and everything in it.

Mac OS High Sierra or newer: (ty to Kirk in the comments below)

$ sudo chown -R $(whoami) $(brew --prefix)/*

Previous versions of macos:

$ sudo chown -R $USER:admin /usr/local/include

Then do another

$ brew doctor

What worked for me was too

sudo chmod g+w /usr/local
sudo chgrp staff /usr/local