[Berkshelf3] berks installでOpenSSL::SSL::SSLError: SSL_connect 

Berkshelf3系で`berks install`すると、途中で以下のエラーに遭遇。作業マシンはMac OS X 10.8.5 Mountain Lion。

```bash
$ bundle exec berks
It looks like you are using an older version of the lockfile. Attempting to convert...
Resolving cookbook dependencies...
Fetching 'kibana' from https://github.com/lusis/chef-kibana.git (at master)
Fetching 'td-agent' from https://github.com/treasure-data/chef-td-agent.git (at master)
Fetching cookbook index from http://api.berkshelf.com...
Installing 7-zip (1.0.2) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing apt (2.6.0) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing aws (2.5.0) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing apache2 (2.0.0) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing ark (0.9.0) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing bluepill (2.3.1) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
Installing build-essential (2.1.2) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
E, [2014-10-23T23:59:37.920984 #2003] ERROR -- : Actor crashed!
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:920:in `connect'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:920:in `block in connect'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/timeout.rb:76:in `timeout'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:920:in `connect'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/net/http.rb:852:in `start'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:313:in `open_http'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:724:in `buffer_open'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:210:in `block in open_loop'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:208:in `catch'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:208:in `open_loop'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:149:in `open_uri'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:704:in `open'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/2.1.0/open-uri.rb:34:in `open'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/community_rest.rb:183:in `block in stream'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/retryable-1.3.6/lib/retryable.rb:17:in `retryable'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/community_rest.rb:182:in `stream'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/community_rest.rb:101:in `download'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/downloader.rb:53:in `try_download'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/downloader.rb:33:in `block in download'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/downloader.rb:32:in `each'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/downloader.rb:32:in `download'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/berkshelf-3.1.5/lib/berkshelf/installer.rb:105:in `install'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:63:in `dispatch'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
        (celluloid):0:in `remote procedure call'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:92:in `value'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/proxies/sync_proxy.rb:33:in `method_missing'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/proxies/cell_proxy.rb:17:in `_send_'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/pool_manager.rb:41:in `_send_'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/pool_manager.rb:140:in `method_missing'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:63:in `dispatch'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
        /Users/niku4i/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'
Installing chef_handler (1.1.6) from http://api.berkshelf.com ([opscode] http://supermarket.getchef.com/api/v1)
E, [2014-10-23T23:59:37.928932 #2003] ERROR -- : Actor crashed!
```

### homebrew ca-bundleを更新して改善

以下の操作で解決できた! これにたどり着くのに結構苦労した...

```bash
$ 
$  brew install curl-ca-bundle
==> Downloading https://downloads.sourceforge.net/project/machomebrew/mirror/curl-ca-bundle-1.87.tar.bz2
######################################################################## 100.0%
==> Caveats
To use these certificates with OpenSSL:

  export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
==> Summary
 /usr/local/Cellar/curl-ca-bundle/1.87: 2 files, 252K, built in 6 seconds

$ brew list curl-ca-bundle
/usr/local/Cellar/curl-ca-bundle/1.87/share/ca-bundle.crt

$ sudo cp /usr/local/Cellar/curl-ca-bundle/1.87/share/ca-bundle.crt /usr/local/etc/openssl/cert.pem                                                    
```

### 参考

[homebrew で入れた openssl を使って Ruby をコンパイルすると SSL 利用時に証明書エラーが発生する場合の対応](http://qiita.com/hotchpotch/items/12457815d5cee3723b97)