Use the commands sudo chown -R $(whoami) /usr/local/* and sudo chmod -R g+w /usr/local/* to fix permission problems.