I don't know exactly why but with Ruby 2.2.2p95 on OSX I get the following error
when I try to use the elasticsearch gem:
Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
To fix it, just try to avoid using rubys build in Net::HTTP lib and switch to another
one (for example typheous). Just add it to your Gemfile, let Bundler run and the
elasticsearch gem will use it by itself:
gem 'typhoeus', require: 'typhoeus/adapters/faraday'
Rbenv is awesome. I find it the most simple solution to handle different Ruby
versions. But if you use it with tons of other stuff like brew and heroku you
have to take care in what order you set your paths to use everytime the right
bins for loading your applications. Here is what I use in my .bash_profile:
export PATH="$HOME/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/heroku/bin:$PATH"
eval "$(rbenv init -)"
export PATH="./.bundle/bin:$PATH"
First add heroku, then add everything related to brew and then add everything
related to rbenv. After this, load rbenv and your currently selected Ruby
version. If you find gemsets useless like I do add the last line of the
example also. This will load all the binstubs in the current directory that you
can create with the --binstubs
option for bundler. To make it even more
convenient add this also to your .bash_profile:
alias bi='bundle --binstubs .bundle/bin'
Now you can bundle with binstubs by just typing "bi" and all gems and bins will
load in the following order:
- project specific gems in the current folder
- ruby specific gems from with rbenv currently selected ruby version
- gems/bins installed with brew
- gems/bin installed in the system