You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Homebrew安装watchman时出现酒窖keg未链接及brew link失败错误

解决Homebrew安装watchman时python@2的brew link错误

先还原你遇到的报错场景:

==> Installing watchman dependency: python@2
==> Downloading https://homebrew.bintray.com/bottles/python@2-2.7.14_3.high_sierra.bottle.2
######################################################################## 100.0%
==> Pouring python@2-2.7.14_3.high_sierra.bottle.2.tar.gz
Error: An unexpected error occurred during the brew link step
The formula built, but is not symlinked into /usr/local

这个问题我之前折腾watchman时也碰到过,大概率是权限冲突或者旧链接干扰导致的,给你几个亲测有效的解决步骤:

  • 修复/usr/local目录权限
    很多时候brew链接失败,是因为当前用户没有/usr/local目录的所有权,执行这条命令把权限转回当前用户:

    sudo chown -R $(whoami) /usr/local
    

    输入系统密码执行后,再尝试手动链接python@2:brew link python@2

  • 强制覆盖冲突链接
    如果是系统里已有其他Python版本的链接导致冲突,用--overwrite参数强制覆盖:

    brew link --overwrite python@2
    
  • 彻底重装python@2
    要是上面的方法都不管用,先卸载已安装的python@2,再重新安装:

    brew uninstall python@2
    brew install python@2
    

    安装完成后再执行一次brew link python@2

  • 让brew自己诊断修复
    最后可以用brew自带的诊断工具排查所有潜在问题:

    brew doctor
    

    它会列出所有异常情况和对应的修复命令,跟着提示操作就行。

搞定上面的步骤后,再重新执行brew install watchman,应该就能顺利完成安装了。

内容的提问来源于stack exchange,提问作者doctopus

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 09:57:49