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

MacOS Ventura13.3下bundle install安装eventmachine失败求助

问题:bundle install安装eventmachine 1.2.7失败,但单独gem install成功

已有多个类似问题案例,但本次情况有所不同,相关问题已提交。

环境背景

$ which ruby                                                                                                
/Users/johnlarkin/.rvm/rubies/ruby-3.1.3/bin/ruby
$ ruby -v
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin22]
$ which openssl
/opt/homebrew/opt/openssl@3/bin/openssl
$ openssl version                                                                                           
OpenSSL 3.1.0 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)

可成功执行的安装方式

单独使用gem命令可以成功安装指定版本:

$ gem install eventmachine -v '1.2.7' -- --with-ssl-dir=/opt/homebrew/opt/openssl@3
Building native extensions with: '--with-ssl-dir=/opt/homebrew/opt/openssl@3'
This could take a while...
Successfully installed eventmachine-1.2.7
Parsing documentation for eventmachine-1.2.7
Done installing documentation for eventmachine after 0 seconds
1 gem installed

bundle install报错信息

执行bundle install时出现链接错误,具体内容如下:

^
4 warnings generated.
linking shared-object rubyeventmachine.bundle
Undefined symbols for architecture arm64:
  "_SSL_get1_peer_certificate", referenced from:
      SslBox_t::GetPeerCert() in ssl.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rubyeventmachine.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/johnlarkin/Desktop/Coding_Learning/github_files/johnlarkin1.github.io/vendor/bundle/ruby/3.1.0/gems/eventmachine-1.2.7
for inspection.
Results logged to
/Users/johnlarkin/Desktop/Coding_Learning/github_files/johnlarkin1.github.io/vendor/bundle/ruby/3.1.0/extensions/arm64-darwin-22/3.1.0/eventmachine-1.2.7/gem_make.out

An error occurred while installing eventmachine (1.2.7), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '1.2.7' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  jekyll-sleek was resolved to 0.1.9, which depends on
    jekyll-seo-tag was resolved to 2.8.0, which depends on
      jekyll was resolved to 3.9.2, which depends on
        em-websocket was resolved to 0.5.3, which depends on
          eventmachine

解决思路
  • 配置Bundler使用指定编译参数:执行以下命令让Bundler在安装eventmachine时沿用单独gem安装的SSL路径配置:

    bundle config set build.eventmachine --with-ssl-dir=/opt/homebrew/opt/openssl@3
    

    配置完成后重新运行bundle install即可。

  • 清理旧gem缓存后重试:如果本地存在冲突的gem版本,先清理缓存再执行安装:

    bundle clean --force
    bundle install
    
  • 升级eventmachine版本:eventmachine 1.2.7对OpenSSL 3.x兼容性较差,尝试升级到更高版本(如1.2.7.1),修改Gemfile中的版本约束后重新执行bundle install。

  • 通过环境变量指定OpenSSL库路径:在执行bundle install前设置环境变量,强制使用指定的OpenSSL库:

    export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
    bundle install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.25 11:59:59