Running brew generates warnings
-
14-10-2019 - |
سؤال
I installed the latest Homebrew on OS X 10.6.5
Running any command generates this warning:
/usr/local/Library/Homebrew/global.rb:34: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Why I'm getting this warning? and how to remedy?
المحلول
First, there are two brew commands that are helpful when debugging problems. They are:
$ brew doctor
$ brew missing
Second, Homebrew is telling you that /usr/local/bin
is set to be too permissive in who can write to that directory -- a potential security problem. To remedy this, you can reset your permissions back to what Homebrew intended.
$ chmod 755 /usr/local/bin
If you get an error while trying to do this, it may mean that your /usr/local directory (and subdirectories) are owned by the wrong user. If that's the case, I would consider deleting your /usr/local directory and reinstalling Homebrew correctly. Alternatively, you can override the error by prefixing the last command with sudo and entering your admin password:
$ sudo chmod 755 /usr/local/bin
نصائح أخرى
I had the same problem and just fixed it with these 3 commands, roughly taken from Homebrew installation script:
sudo chgrp -R admin /usr/local
sudo chmod -R g+rwx /usr/local
sudo chmod -R o-w /usr/local
This is a security feature of ruby, you can change permissions on the directory /usr/local/bin to get rid of this by running:
sudo chmod go-w /usr/local/bin
and entering your password on the prompt.
You do not need to change ownership and neither should delete /usr/local as Ryan suggested (that would require you to rebuild everything you´ve accomplished so far), the directory is owned by root and this is the usual way.