使用 brew 安装 openconnect 时出现问题

Problem when installing openconnect using brew

我在尝试使用自制软件安装“openconnect”时卡住了,因为不允许我将符号 link 设为 /usr/local/share/locale/ca/LC_MESSAGES。 我是 运行 Big Sur 11.4 版。

以下是我尝试过的内容:

(base) MacBook-Pro-5:Data Eigil$ brew uninstall --force openconnect

Uninstalling openconnect... (54 files, 2.8MB)

(base) MacBook-Pro-5:Data Eigil$ brew cleanup -s openconnect

Removing: /Users/Eigil/Library/Caches/Homebrew/openconnect--8.10... (971.3KB)

(base) MacBook-Pro-5:Data Eigil$ brew cleanup --prune-prefix

(base) MacBook-Pro-5:Data Eigil$ brew install openconnect

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 8 formulae.
==> Updated Casks
Updated 1 cask.

==> Downloading https://ghcr.io/v2/homebrew/core/openconnect/manifests/8.10
Already downloaded: /Users/Eigil/Library/Caches/Homebrew/downloads/c979ec1baea5847f748962ba42b95bce88cef90599731a131c5588090c9c066b--openconnect-8.10.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openconnect/blobs/sha256:9755c4ea66ed9c8aa1f1ee966c932ec2be37849887636d8f65a920f20c16ec55
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:9755c4ea66ed9c8aa1f1ee966c932ec2be37849887636d8f65a920f20c16ec55?
######################################################################## 100.0%
==> Pouring openconnect--8.10.big_sur.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/locale/ca/LC_MESSAGES/openconnect.mo
/usr/local/share/locale/ca/LC_MESSAGES is not writable.

You can try again using:
  brew link openconnect
==> Summary
  /usr/local/Cellar/openconnect/8.10: 54 files, 2.8MB

建议的解决方案不起作用(仍然是因为我无法写入 LC_MESSAGES)。 sudo 也不允许在该目录上。

ls -l /usr/local/share/locale/ca/

给出:

total 0

drwxr-xr-x  3 root  wheel  96 Jun 28 11:34 LC_MESSAGES/

如有任何帮助,我们将不胜感激。

Homebrew 不适用于 sudo。你不应该在命令 brew 之前添加 sudo,这会改变一些 brew 相关文件的所有权。

结果是有些文件现在不属于您,而属于 root。您必须修复权限。

# For x86 Mac
sudo chown -R "$(whoami):admin" /usr/local/*

# For M1 mac
sudo chown -R "$(whoami):admin" /opt/homebrew/*

# NOTE:
# * in /usr/local/* is used on purpose to only match the sub folders, files
# The command will take some time, wait patiently.

您最好在上述修复后重新安装 openconnect