Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to install MySQL via Homebrew. The install seems to work fine but i get an error:

"Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link mysql'"

Naturally, after this I ran:

brew link mysql

Which spat out:

Error: Could not symlink file: /usr/local/Cellar/mysql/5.5.20/include/typelib.h
/usr/local/include is not writable. You should change its permissions.

So I ran it with sudo and got a "cowardly refusing to brew link mysql".

share|improve this question
up vote 29 down vote accepted

Obviously that folder doesn't belong to you. Just try with:

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

You never have to use brew with sudo. If you do, something is wrong with your installation.

Then, try the link command again.

share|improve this answer
    
worked -- thanks so much! – Asad Syed Jun 12 '12 at 21:54
    
When I do I'm getting this error .. chown: /usr/local/include: No such file or directory .. – Srikanth Jeeva Sep 9 '14 at 20:50
    
There is no directory named like include. I get errors with another directory, so I run it for /usr/local and works fine. – JosephCastro Nov 13 '14 at 22:36

slhck's answer is great, but I think it is a little cleaner if you are a member of the admin group (probably are if you are using Homebrew) to make all locations in /usr/local writable to group.

sudo chmod -R g+w /usr/local
share|improve this answer
    
did not work for me when linking nmap installed by brew on a mac. chosen answer worked. – mles Oct 16 '15 at 10:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .