Trying to install MySQL, lots of brew doctor errors

homebrewMySQLosx lion

In OS X Lion I couldn't install mysql. I get this when typing brew install mysql

Error: You must `brew link cmake' before mysql can be installed 

so then I type brew link cmake

Linking /usr/local/Cellar/cmake/2.8.8... 
Error: Could not symlink file: /usr/local/Cellar/cmake/2.8.8/share/doc/cmake
/usr/local/share/doc is not writable. You should change its permissions.

When I typed brew doctor I get this:

Error: "config" scripts exist outside your system or Homebrew directories. ./configure scripts often look for *-config scripts to
determine if software packages are installed, and what additional
flags to use when compiling and linking.

Having additional scripts in your path can confuse software installed
via Homebrew if the config script overrides a system or Homebrew
provided script of the same name. We found the following "config"
scripts:

/opt/sm/pkg/active/bin/curl-config
/opt/sm/pkg/active/bin/ncurses5-config
/opt/sm/pkg/active/bin/ncursesw5-config
/opt/sm/pkg/active/bin/pkg-config
/opt/sm/pkg/active/bin/xml2-config
/opt/sm/pkg/active/bin/xslt-config

Error: gettext was detected in your PREFIX. The gettext provided by Homebrew is "keg-only", meaning it does not get linked into your
PREFIX by default.

If you brew link gettext then a large number of brews that don't
otherwise have a depends_on 'gettext' will pick up gettext anyway
during the ./configure step.

If you have a non-Homebrew provided gettext, other problems will
happen especially if it wasn't compiled with the proper architectures.

Error: Unbrewed dylibs were found in /usr/local/lib. If you didn't put them there on purpose they could cause problems when building
Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
/usr/local/lib/libboost_filesystem-mt.dylib /usr/local/lib/libboost_serialization-mt.dylib
/usr/local/lib/libboost_system-mt.dylib
/usr/local/lib/libencfs.6.dylib /usr/local/lib/libintl.8.dylib
/usr/local/lib/libmacfuse_i32.2.dylib
/usr/local/lib/libmacfuse_i64.2.dylib
/usr/local/lib/libosxfuse_i32.2.dylib
/usr/local/lib/libosxfuse_i64.2.dylib
/usr/local/lib/librlog.5.0.0.dylib

Error: Unbrewed .la files were found in /usr/local/lib. If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .la files:
/usr/local/lib/libosxfuse_i32.la /usr/local/lib/libosxfuse_i64.la

Error: Unbrewed .pc files were found in /usr/local/lib/pkgconfig. If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected .pc files:
/usr/local/lib/pkgconfig/osxfuse.pc

Error: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to
fail to run properly once built.

cmake

Error: Your pkg-config is not checking "/usr/X11/lib/pkgconfig" for packages. Earlier versions of the pkg-config formula did not add
this path to the search path, which means that other formula may not
be able to find certain dependencies.

To resolve this issue, re-brew pkg-config with: brew rm pkg-config
&& brew install pkg-config

Error: You have a non-Homebrew 'pkg-config' in your PATH: /opt/sm/pkg/active/bin/pkg-config

./configure may have problems finding brew-installed packages using
this other pkg-config.

Error: Your Xcode is configured with an invalid path. You should change it to the correct path. Please note that there is no correct
path at this time if you have only installed the Command Line Tools
for Xcode. If your Xcode is pre-4.3 or you installed the whole of
Xcode 4.3 then one of these is (probably) what you want:

sudo xcode-select -switch /Developer
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

DO NOT SET / OR EVERYTHING BREAKS!

Best Answer

I'm fairly certain this is just because you don't fully own /usr/local. It's actually what the error message says. Try:

sudo chown -R $(whoami) /usr/local

See if that fixes the errors.

Related Question