I just upgraded from Snow Leopard to Lion and am trying to get Homebrew installed. However after the installation, I run brew doctor
per the installation instructions, and see a series of errors indicating that /usr/local directories aren't writable. For example:
Error: /usr/local/share 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 file to this directory, the install will
fail during the link step.
You should probably `chown` /usr/local/share
I get these for a bunch of directories:
You should probably `chown` /usr/local/include
You should probably `chown` /usr/local/share
You should probably `chown` /usr/local/share/man
I can't figure out why this error is coming up, as it appears that I am part of the Unix group that has write permissions to these directories:
Mini:~ felciano$ ls -ld /usr/local/share
drwxrwxr-x 4 root admin 136 May 13 15:53 /usr/local/share
Mini:~ felciano$ whoami
felciano
Mini:~ felciano$ dscl . -read /Groups/admin GroupMembership
GroupMembership: root felciano
Mini:~ felciano$
What am I missing?
Best Answer
EDIT: The problem is now fixed in Homebrew:
If you still experience the problem, update Homebrew like this:
If you want to know what the problem was, I have kept my original answer below.
Ignore the permisson issue for now
I am experiencing the exact same problem and in my opinion the problem is in
brew doctor
rather than in your and my installation.I think you should ignore the issue rather than changing the ownership of
/usr/local
. Alternatively, you could fix your localbrew doctor
script until a fix is released. See below.I don't consider it correct to make
/usr/local
owned by a specific user. I have more than one admin user on this machine. You should leave/usr/local
owned byroot:admin
as owner and group.My investigation
Like for you I have a
/usr/local
that is perfectly writable by my user which is also a member of theadmin
group:Let's test that the dir is really writable:
Further investigation into the
brew doctor
code led my to the conclusion that the use of the ruby functionPathname.writable?
is causing the problem. Consider this interactive Ruby session:Function
Pathname.writable?
says/usr/local
is not writable even though we know it is.Using
Pathname.writable_real?
instead gives the correct result – it says that the dir is writable:This should be fixed in
/usr/local/Library/Homebrew/cmd/doctor.rb
. You can fix it in your own installation while waiting for a fix.The difference between the two functions are (according to the Ruby docs here and here):
writable?(file_name) → true or false: Returns true if the named file is writable by the effective user id of this process.
writable_real?(file_name) → true or false: Returns true if the named file is writable by the real user id of this process.