无法安装 Jekyll - “致命错误:找不到‘openssl/ssl.h’文件”

bde*_*ans 3 ruby openssl bundle rubygems jekyll

我正在尝试在 Mac OS 上本地托管 Jekyll 站点。下载 Jekyll 后,gem install jekyll我遇到了错误:

current directory: /Users/main/.rvm/gems/ruby-3.0.0/gems/eventmachine-1.2.7/ext
make DESTDIR\= sitearchdir\=./.gem.20221106-46436-a98sx9 sitelibdir\=./.gem.20221106-46436-a98sx9
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:119:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
         ^~~~~~~~~~~~~~~
1 error generated.
make: *** [binder.o] Error 1

make failed, exit code 2
Run Code Online (Sandbox Code Playgroud)

我使用的是 MacOS Ventura 13.0。

  • openssl version回报LibreSSL 3.3.6

  • jekyll -v返回can't find gem jekyll (>= 0.a) with executable jekyll (Gem::GemNotFoundException)(显然)

  • ruby -v回报ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin22]

  • gem -v回报3.3.25

  • bundle -v回报Bundler version 2.3.25

  • rvm list回报=* ruby-3.0.0 [ x86_64 ]

  • gem list回报

rubygems-bundler (1.4.5)
rubygems-update (3.3.25, 3.0.0)
rvm (1.11.3.9)
Run Code Online (Sandbox Code Playgroud)

... 除其他事项外。没有列出 Ruby 版本。

我尝试过brew link --force openssl,这样我就可以运行gem install event machine(带标志),但brew link --force openssl返回

If you need to have openssl@3 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc
Run Code Online (Sandbox Code Playgroud)

我运行了该命令,重新运行brew link --force openssl,它返回了相同的错误。

我该怎么办?感谢您的任何帮助。

Chr*_*ian 5

我在安装 Jekyll 的 M1 Mac 上遇到了类似的 eventmachine 问题。虽然这是受到Stackoverflow启发的,但运行brew link --force openssl并没有解决我的问题。

我可以按如下方式解决这些 Openssl 问题:

  1. 运行brew --prefix openssl以检查 openSSL 路径。如果未安装 OpenSSL,请先安装。
  2. 跑步bundle config build.eventmachine --with-openssl-dir=$(brew --prefix openssl)
  3. 跑步bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
  4. 跑步bundle

另请参阅此GitHub 讨论,您是否尝试运行brew list openssl以查看是否安装了不同的 openSSL 版本?