刚安装El Capitan,不能安装gem eventmachine 1.0.7。Openssl的版本是1.0.2a-1。尝试使用——with-ssl-dir,但似乎被忽略了。

报告到他们的github回购以及。

任何建议都非常感谢。谢谢。

$ ls /usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h
/usr/local/Cellar/openssl/1.0.2a-1/include/openssl/ssl.h

$ gem install eventmachine -v '1.0.7' -- --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1/include
/Users/pain/.rbenv/versions/2.1.2/bin/ruby -r ./siteconf20150612-56154-1hsjz2n.rb extconf.rb --with-ssl-dir=/usr/local/Cellar/openssl/1.0.2a-1/include
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... yes
checking for rb_thread_fd_select()... yes
checking for rb_fdset_t in ruby/intern.h... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for sys/event.h... yes
checking for sys/queue... yes
checking for clock_gettime()... no
checking for gethrtime()... no
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling binder.cpp
In file included from binder.cpp:20:
./project.h:116: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

当前回答

brew link --force openssl

然后:

gem install eventmachine

它还修复:

Gem安装开销 包安装 Rake和rails任务

注:你可能需要再次删除并运行brew install openssl

这个问题是因为苹果已经从OSX中删除了openssl(在El Captain版本中)

其他回答

如果你将EventMachine作为另一个gem的依赖项安装,请确保在手动安装gem时指定正确的版本:

gem install eventmachine -v 1.0.5 -- --with-cppflags=-I$(brew --prefix openssl)/include

然后你可以安装你最初试图安装的gem:

gem install mailcatcher

这看起来像是一个最近的问题:https://github.com/eventmachine/eventmachine/issues/936

我在macOS 12.3.1上用以下方法解决了这个问题:

M1马克斯:

gem install eventmachine -- --with-openssl-dir=/opt/homebrew/Cellar/openssl@1.1/1.1.1n/

英特尔:

gem install eventmachine -- --with-openssl-dir=/usr/local/Cellar/openssl@1.1/1.1.1n/

这为我安装了它:

gem install eventmachine -- --with-openssl-dir=/usr/local/opt/openssl@1.1

我从Github的eventmachine上买的。显然,OpenSSL工具在某个时候从MacOS中移动/删除了。

在我的例子中,我想安装其他依赖于eventmachine的东西(mailcatcher)。我通过在上面的命令中用mailcatcher替换eventmachine来做到这一点。

在openssl@3和Homebrew中,它通过运行以下命令工作:

gem install eventmachine -- --with-openssl-dir=/usr/local/opt/openssl@3/bin/openssl

注意:最后的/bin/openssl对我来说是不同的。

当使用bundler和homebrew时:

$ bundle config build.eventmachine --with-cppflags=-I$(brew --prefix openssl)/include
$ bundle install