自制软件:无法符号链接,/usr/local/share/man/man7 不可写

Homebrew: Could not symlink, /usr/local/share/man/man7 is not writable

我正在 OSX 上安装 LightGBM,紧随 installation guide。在安装 cmake 时,Homebrew 给出这样的警告信息:

Warning: cmake-3.8.1 already installed, it's just not linked.

那我试试:

$brew link cmake

它给出:

Linking /usr/local/Cellar/cmake/3.8.1...
Error: Could not symlink share/man/man7/cmake-buildsystem.7
/usr/local/share/man/man7 is not writable.

Mark Setchell 使用 sudo chown -R $(whoami):admin /usr/local/share/man 的提议是正确的。根据 Homebrew troubleshooting page:

If commands fail with permissions errors, check the permissions of /usr/local’s subdirectories. If you’re unsure what to do, you can run cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var Frameworks

但是Nano使用sudo的命题不是很好。根据 Homebrew FAQ:

Homebrew is designed to work without using sudo. You can decide to use it but we strongly recommend not to do so. If you have used sudo and run into a bug then this is likely to be the cause. Please don’t file a bug report unless you can reproduce it after reinstalling Homebrew from scratch without using sudo.

只需按照这 4 个步骤

  1. sudo chown -R $(whoami) $(brew --prefix)/*
  2. brew doctor
  3. brew prune
  4. brew link cmake