在 OS X 上使用 Homebrew 安装 ocaml 时出错

在 OS X 上使用 Homebrew 安装 ocaml 时出错

我正在尝试在我的 Mac 上安装 objective-ocaml 来编译我想要安装的另一个应用程序(Unison),但是这样做时出现了错误。

    imrans-mac:/ Imran$ brew doctor Warning: You have unlinked kegs in your Cellar Leaving kegs unlinked can lead to build-trouble and cause brews that depend on those kegs to fail to run properly once built. Run `brew link` on these:

    objective-caml 

    imrans-mac:/ Imran$ brew link objective-caml Linking /usr/local/Cellar/objective-caml/4.01.0... Warning: Could not link objective-caml. Unlinking...

    Error: Could not symlink file: /usr/local/Cellar/objective-caml/4.01.0/lib/ocaml/weak.p.cmx Target /usr/local/lib/ocaml/weak.p.cmx already exists. You may need to delete it. To force the link and overwrite all other conflicting files, do:   brew link --overwrite formula_name

    To list all files that would be deleted:   brew link --overwrite
    --dry-run formula_name imrans-mac:/ Imran$ brew link --overwrite objective-ocaml Error: No such keg: /usr/local/Cellar/objective-ocaml

答案1

首先,运行brew doctor。这应该可以清除所有权限错误。通常也可以解决大多数问题。

在错误日志中记录这一点:

brew link --overwrite formula_name

也在那里尝试一下。这里最大的问题是文件/文件夹权限不允许您symlink在那里写入或写入。

要修复权限,您可能需要尝试这个:

sudo chown -R $USER:admin /usr/local

我刚刚也尝试安装 unison,没有任何问题。

相关内容