关于homebrew使用时遇到的问题: Error: Could not symlink bin/gdb/usr/local/bin is not writable.

关于homebrew使用时遇到的问题: Error: Could not symlink bin/gdb/usr/local/bin is not writable.


这是我在给我的Mac电脑安装GDB的时候遇到的问题:

我的Mac使用homebrew管理,于是我使用brew install gdb命令直接安装gdb,结果如下:

我在stackoverflow找到了发生的类似情况,经过阅读判断,找到了一下两种解决办法:

  • 如图,直接输入命令:

命令内容:

sudo chown -R `whoami`:admin /usr/local/bin
  • 如图,为了谨慎起见,使用homebrew doctor进行检测,根据其反馈来进行操作:

我认为应该使用第二中方法比较好,于是我在终端输入homebrew doctor,稍作等待得到检测结果:

如划红线部分所示,与我遇到的问题相符合,运行其解决方案:
sudo chown -R $(whoami) /usr/local/bin
在此时再link一下我的GDB:
brew link gdb
结果如下:
Already linked: /usr/local/Cellar/gdb/8.0.1
再测试一下GDB:
gdb
结果如下:

成功.

那么问题的原因是什么呢?

  • 问题出现在我之前安装OpenSSL时使用了sudo make install命令,导致了一些软件非homebrew管理,所以homebrew在Link的时候会出现问题。
  • 参考homebrew doctor如下提示:
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.

参考资料

用brew安装node遇到的问题
Error: The 'brew link' step did not complete successfully
homebrew could not symlink usr/local/bin is not writable

posted @ 2017-11-12 22:47  blackay03  阅读(3944)  评论(0编辑  收藏  举报
Live2D
*/