gpt4 book ai didi

permissions - Homebrew 权限。/usr/local/sbin 不可写

转载 作者:行者123 更新时间:2023-12-03 13:18:15 28 4
gpt4 key购买 nike

我正在使用 OSX 10.12,最近遇到了一个奇怪的问题。如果我使用 Homebrew 安装包,则无法链接该包,因为权限不正确。运行后brew doctor我收到以下消息:

Warning: The following directories are not writable:
/usr/local/sbin

This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

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

在运行我在网上找到的许多不同的权限命令后,我仍然在努力解决这个问题。我尝试了(至少)以下命令
sudo chown -R $(whoami) /usr/local
sudo chown -R $(whoami) /usr/local/sbin
sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew

非使用过的突击队在哪里工作。我试过 brew docter在每个权限命令之后,但似乎没有任何效果。然后我认为它应该使用 ls -la 查看权限在 usr/local 目录中。我注意到 sbin 文件夹是符号链接(symbolic link)的。请参阅下面的列表了解我在 usr/local 文件夹中的权限。不知道这个好不好??这可能是我的问题的原因吗?我该如何解决这个问题?
drwxrwxr-x   16 myusername  staff   544 Oct 10 16:10 .
drwxr-xr-x@ 10 root wheel 340 Mar 28 2017 ..
drwxrwxr-x 2 myusername staff 68 Oct 10 16:10 Caskroom
drwxr-xr-x 48 myusername staff 1632 Oct 10 16:47 Cellar
drwxr-xr-x 2 myusername staff 68 Dec 8 2016 Frameworks
drwxr-xr-x 17 myusername staff 578 Oct 10 15:20 Homebrew
drwxr-xr-x 198 myusername staff 6732 Oct 10 16:48 bin
drwxr-xr-x 18 myusername staff 612 Oct 10 16:48 etc
drwxr-xr-x 65 myusername staff 2210 Oct 10 16:48 include
drwxr-xr-x 244 myusername staff 8296 Oct 10 16:48 lib
drwxr-xr-x 3 myusername staff 102 Dec 12 2014 man
drwxr-xr-x 57 myusername staff 1938 Oct 10 16:51 opt
drwxr-xr-x 3 myusername staff 102 Feb 14 2017 remotedesktop
lrwxr-xr-x 1 myusername staff 9 Jun 9 2013 sbin -> /usr/sbin
drwxr-xr-x 18 myusername staff 612 Oct 10 16:48 share
drwxr-xr-x 10 myusername staff 340 Oct 10 15:28 var

这是 brew --config 的输出命令
HOMEBREW_VERSION: 1.3.5
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 91ab116ace7f4f97d3440190463c93be9ec6d675
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a57a3704b4e7a8dcb311cf2309d485ad93d4977d
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 9.0 build 900
Git: 2.13.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.6-x86_64
Xcode: 9.0
CLT: 9.0.0.0.1.1504363082
X11: N/A

这是符号链接(symbolic link)的 sbin 文件夹的权限
drwxr-xr-x   246 root            wheel   8364 Aug  4 02:08 sbin

最佳答案

运行brew doctor应该告诉你:

Warning: The following directories do not exist: /usr/local/sbin



赶紧跑:
sudo mkdir -p /usr/local/sbin

和:
sudo chown -R $(whoami) /usr/local/sbin

关于permissions - Homebrew 权限。/usr/local/sbin 不可写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670727/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com