bundle コマンドで SSL エラーが出て進めない

bundle コマンドを実行したところ、SSLのエラーが出て前へ進めない。

 

Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

 

OpenSSLなどSSL周りを最新化するのが本筋なのだけど、OSに手を出せないユーザ権限しかない場合、とりあえず今だけ無理やり証明書エラーを無視したい場合。

ホームディレクトリの .gemrc ファイルに以下を書けばよい。

 

:ssl_verify_mode: 0

 

証明書のチェックをしなくなる。

※参考 OpenSSL Errors and Rails – Certificate Verify Failed · RailsApps

それでもやっぱりエラーが出る場合は、Gemfileの中を書き換えよう。

Gemfile の最初のほうに

 

source 'https://rubygems.org'

 

とあるだろうから、これを http にしてしまう。

 

source 'http://rubygems.org'

 

ここまでやれば通るだろう。