El Capitanにpumaを入れようとしたらエラーになった

Posted on
ruby

El Capitanをクリーンインストールしたところにpumaを入れようとしたらエラーになった。

そんときのエラーはこんな感じ。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Installing puma 2.11.2 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/jyun1/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20151122-59029-1hxodqo.rb extconf.rb
checking for BIO_read() in -lcrypto... yes
checking for SSL_CTX_new() in -lssl... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling http11_parser.c
compiling io_buffer.c
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
  return rb_str_new(b->top, b->cur - b->top);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jyun1/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:796:20: note: expanded from macro 'rb_str_new'
        rb_str_new_static((str), (len)) : \
                          ^~~~~
/Users/jyun1/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:727:37: note: passing argument to parameter here
VALUE rb_str_new_static(const char *, long);
                                    ^
io_buffer.c:119:10: warning: passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'const char *' converts between pointers to integer types with different sign [-Wpointer-sign]
  return rb_str_new(b->top, b->cur - b->top);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/jyun1/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:797:13: note: expanded from macro 'rb_str_new'
        rb_str_new((str), (len));         \
                   ^~~~~
/Users/jyun1/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/intern.h:706:29: note: passing argument to parameter here
VALUE rb_str_new(const char*, long);
                            ^
2 warnings generated.
compiling mini_ssl.c
In file included from mini_ssl.c:3:
/Users/jyun1/.rbenv/versions/2.2.2/include/ruby-2.2.0/ruby/backward/rubyio.h:2:2: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
 ^
mini_ssl.c:4:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
         ^
1 warning and 1 error generated.
make: *** [mini_ssl.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/jyun1/Projects/HackeyWebapp/vendor/bundle/ruby/2.2.0/gems/puma-2.11.2 for inspection.
Results logged to /Users/jyun1/Projects/HackeyWebapp/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/puma-2.11.2/gem_make.out
An error occurred while installing puma (2.11.2), and Bundler cannot continue.
Make sure that `gem install puma -v '2.11.2'` succeeds before bundling.

んで、調べたところここにあるとおり、

1
$ bundle config build.puma --with-opt-dir=/usr/local/opt/openssl

してから

1
$ bundle install

したらうまくいった。