跳到主要内容

修复 MacOS 中的开发者验证错误

·2 分钟阅读
了解如何在使用系统设置或终端运行 ClickHouse 命令时解决 MacOS 开发者验证错误。

修复 MacOS 中的开发者验证错误

如果您使用 brew 安装 ClickHouse,您可能会遇到来自 MacOS 的错误。默认情况下,MacOS 不会运行无法验证的开发者创建的应用程序或工具。

当尝试运行任何 clickhouse 命令时,您可能会看到此错误

MacOS showing a developer verification error.

要解决此验证错误,您需要通过在系统设置窗口中找到相应的设置、使用终端或重新安装 ClickHouse,从 MacOS 的隔离区中删除该应用程序。

系统设置流程

从隔离区删除 clickhouse 可执行文件的最简单方法是

  1. 打开系统设置

  2. 导航到隐私与安全

  3. 滚动到窗口底部,找到一条消息,提示 _“clickhouse-macos-aarch64”因不是来自已识别的开发者而被阻止使用_。

  4. 点击仍然允许

  5. 输入您的 MacOS 用户密码。

您现在应该能够在终端中运行 clickhouse 命令。

终端流程

有时,按 仍然允许 按钮并不能解决此问题,在这种情况下,您也可以使用命令行执行此过程。或者您可能只是更喜欢使用命令行!

首先找出 Homebrew 安装 clickhouse 可执行文件的位置

which clickhouse

这应该输出类似以下内容

/opt/homebrew/bin/clickhouse

通过运行 xattr -d com.apple.quarantine,后跟上一个命令中的路径,从隔离区中删除 clickhouse

xattr -d com.apple.quarantine /opt/homebrew/bin/clickhouse

您现在应该能够运行 clickhouse 可执行文件了

clickhouse

这应该输出类似以下内容

Use one of the following commands:
clickhouse local [args]
clickhouse client [args]
clickhouse benchmark [args]
...

## Fix the Issue by Reinstalling ClickHouse

Brew has a command-line option which avoids quarantining installed binaries in the first place.

First, uninstall ClickHouse:

```shell
brew uninstall clickhouse

现在使用 --no-quarantine 重新安装 ClickHouse

brew install --no-quarantine clickhouse