chown:/ usr / local:不允许操作


6

我该如何解决?

Tue Oct 31 21:52:56 mona@dhcp-wifi-8021x-155-41-82-88:~$ brew update && brew upgrade && brew cleanup
Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your
user account:
  sudo chown -R $(whoami) /usr/local
Wed Nov 01 20:41:30 mona@dhcp-wifi-8021x-155-41-82-88:~$ sudo chown -R $(whoami) /usr/local
Password:
chown: /usr/local: Operation not permitted

系统信息:

Wed Nov 01 20:42:36 mona@dhcp-wifi-8021x-155-41-82-88:~$ uname -a
Darwin dhcp-wifi-8021x-155-41-53-197.bu.edu 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64

Wed Nov 01 20:44:03 mona@dhcp-wifi-8021x-155-41-82-88:~$ brew config
HOMEBREW_VERSION: >1.2.0 (shallow or no git repository)
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 38209aadbfe4fd0c6772467c4bc5c63325d53f6c
Last commit: 1 year, 3 months ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 839ca7b9b4ce034b5abdb66cee0ef75bbb675ddf
Core tap last commit: 1 year, 3 months ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
GCC-4.2: build 5666
Clang: 8.0 build 800
Git: 2.9.2 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /Users/mona/anaconda/bin/python => /Users/mona/anaconda/bin/python3.6
Ruby: /Users/mona/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
Java: 1.8.0_71, 1.7.0_60
macOS: 10.13-x86_64
Xcode: 8.0
CLT: 9.0.1.0.1.1506734476
X11: 2.7.11 => /opt/X11
Wed Nov 01 20:44:25 mona@dhcp-wifi-8021x-155-41-82-88:~$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/local is not writable.

You should change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local

Warning: Anaconda is known to frequently break Homebrew builds, including Vim and
MacVim, due to bundling many duplicates of system and Homebrew-available
tools.

If you encounter a build failure please temporarily remove Anaconda
from your $PATH and attempt the build again prior to reporting the
failure to us. Thanks!

Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.

Warning: "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.


1
首先,这并不是一个真正的问题格式。话虽如此,请看关于该问题已被接受答案的第一条评论
JakeGould

Answers:



1

解决此问题的方法是简单地复制usr / local pathv,然后将其粘贴到您的usr文件夹项目中,然后按Command + i后按Command + Shift + g出现的对话框,此时支持的窗口将成为一个信息窗口。滚动到窗口底部,检查读写权限,如果在那里没有看到用户名,请按添加图标添加用户名/管理员帐户


不幸的是,在High Sierra中,它说:无法完成操作,因为您没有必要的许可。
Barnabas Szabolcs

巴拿巴说了什么。
Gudlaugur Egilsson

@BarnabasSzabolcs要解决不允许的操作,请引导进入恢复模式,然后进入外壳窗口/终端窗口,您可以在进入恢复模式屏幕后从菜单栏中的实用程序选项访问该窗口,现在在终端窗口中键入命令csrutil disable(csrutil后将有一个空格),这是因为它禁用了系统完整性保护,该功能在禁用SIP后会给您操作错误,请尝试执行我告诉您的回答!
萨彦

哇,听起来好像您必须深入研究此事...谢谢@Sayan!
Barnabas Szabolcs

@Sayan,您应该给出禁用SIP的答案。那就是帮助我的原因。
马特

1

我在尝试更新brew时得到了这个,所以对我来说更简单的方法是:

须藤chown -R $ {whoami)$ {brew --prefix)/ *


没有为我工作。/ usr / local / *的所有者已更改,但是更新brew仍然失败。
Mikrasya

请问您能否提供更多有关此功能的背景信息?
jtheletter

brew --prefix与/ usr / local相同,但是与上述答案的不同之处在于,它更新了/ usr / local子级的所有权,而不是/ usr / local本身,这对我有用,而不是更改所有权/ usr / local本身
Swami PR
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.