gpt4 book ai didi

macos - Homebrew 多用户设置

转载 作者:行者123 更新时间:2023-12-03 22:36:36 24 4
gpt4 key购买 nike

我试图为多个用户修复我的Homebrew安装,并发现了guide on strug.de,旨在完全解决此问题。

我创建了一个brew用户组,在该组中添加了我的两个用户,然后运行它来调整权限:

sudo chgrp -R brew /usr/local
sudo chmod -R g+w /usr/local
sudo chgrp -R brew /Library/Caches/Homebrew
sudo chmod -R g+w /Library/Caches/Homebrew
sudo chgrp -R brew /opt/homebrew-cask
sudo chmod -R g+w /opt/homebrew-cask


假设我是在登录用户帐户A时执行此操作的。几天后,我登录了用户帐户B,并尝试通过Cask安装Dropbox。这就像一个符咒一样,因为我们更早地修复了权限,所以还允许brew组也可以在那些文件夹中写入。

现在又过了几天,我重新登录到帐户A,并希望摆脱Dropbox。我运行以下命令,但遇到权限错误:

$ brew cask install dropbox --force
==> Downloading https://www.dropbox.com/download?plat=mac&full=1
Already downloaded: /Library/Caches/Homebrew/dropbox-latest
==> Symlinking App 'Dropbox.app' to '/Users/friedmann/Applications/Dropbox.app'
Error: Permission denied - /opt/homebrew-cask/Caskroom/dropbox/.metadata/latest/20150217070443.598

Most likely, this means you have an outdated version of homebrew-cask. Please run:

brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup

If this doesn’t fix the problem, please report this bug:

https://github.com/caskroom/homebrew-cask/issues

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:245:in `mkdir'
[...]


要为用户B解决此问题,我必须再次运行 chgrpchmod(如上所述)。但是,这种解决方法并没有得到真正的赞赏,因为我不想在用户帐户之间来回切换时“随机”运行所有命令。

根据指南,我有什么遗漏或做错了吗?

我不确定指南的作者是如何解决这个问题的。

最佳答案

我从几篇文章中整理了以下内容,因为我无法在一个地方找到所有需要的东西,例如创建群组的命令。

在macOS Mojave 10.14.4(18E226)上为我工作。

brew-multiuser.sh:

#!/bin/bash

# Create a new group, brew
sudo dseditgroup -o create brew

# Change owner to brew group on brew assets
sudo chgrp -R brew $(brew --prefix)/*

# Change permissions to brew group
sudo chmod -R g+w $(brew --prefix)/*

# Add a user to the brew group
sudo dseditgroup -o edit -a userOne -t user brew

# Add another user to the brew group
sudo dseditgroup -o edit -a userTwo -t user brew

# Validate links, etc.
brew doctor

# Make any corrections from the `brew doctor` warnings, such as relinking.

# Run brew doctor to validate fixes
brew doctor

# Make sure it's working without error, with an update
brew update

关于macos - Homebrew 多用户设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28556776/

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