如何在PATH中解决不安全的世界可写dir / usr,在Ruby上模式040777警告?

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13/rbconfig.rb:213: warning: Insecure world writable dir /usr in PATH, mode 040777

我在Stackexchange上搜索解决方案后尝试了这两个命令,但它对我不起作用。 它仍然向我显示我上面粘贴的警告。

 sudo chmod 775 /usr/local sudo chmod go-w /usr/local/bin 

如何修复此警告消息? 我正在运行OS X 10.9 Mavericks

学习密切阅读错误消息。

 Insecure world writable dir /usr in PATH 

注意它不是说/usr/local

要确认此诊断,请使用

  ls -ld /usr drwxrwxrwx 14 ownerID groupID 4096 Dec 10 2010 /usr #-------^- is the world-writeable part 

如您所知,您可以使用它来修复它

  sudo chmod 755 /usr 

编辑

伙计们,请看这里的脚本解决方案。

我通过使用“磁盘工具”来修复磁盘权限。

打开“磁盘工具”应用程序,然后选择安装系统的磁盘。 然后,您可以从“急救”选项卡中选择“修复磁盘权限”。 修复需要几分钟

在Mac OS X 10.11 El Capitan上执行以下操作对我有用

sudo chmod ow /usr/local

加载流浪者时发生错误如下;

vagrant status /opt/vagrant/embedded/gems/gems/vagrant-1.8.1/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr/local in PATH, mode 040777 /opt/vagrant/embedded/gems/gems/bundler-1.10.6/lib/bundler/shared_helpers.rb:78: warning: Insecure world writable dir /usr/local in PATH, mode 040777 ls -dal /usr/local/ drwxrwxrwx 10 root wheel 340 Sep 9 15:05 /usr/local/

运行上面提到的chmod之后。

ls -dal /usr/local/ drwxrwxr-x 10 root wheel 340 Sep 9 15:05 /usr/local/

这解决了这个问题。