Rails Gemfile defaults to 'https' - 'bundle install' fails

烂漫一生 提交于 2020-01-12 10:16:11

问题


I've noticed that when generating a new rails project, the Gemfile now defaults to:

source 'https://rubygems.org'

instead of

source 'http://rubygems.org'

and now bundle install fails for me. When it attempts to run, I get:

/Users/<my user name>/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault

If I manually change the Gemfile to http, then bundle install performs fine.

Is there an error with my setup (I've replicated this on two different boxes), or is there another issue I'm not aware of?


回答1:


You're probably using MacPorts. It installs its own version of openssl, in addition to your local openssl, which causes issues. If that's the case, follow these instructions:

rvm remove ruby-1.9.3
rvm install ruby-1.9.3 --with-openssl-dir=/opt/local



回答2:


I've seen this segfault previously when using a version of Ruby that was compiled against a different version of libssl-dev. That is, if you've updated libssl, but not libssl-dev, since building your rvm ruby, ruby will segfault when linking to libssl, since it was built with the wrong headers. What I did to fix it was make sure that libssl-dev was updated, nuke my ruby with rvm remove, and build it again.

EDIT: I knew I found more information about this somewhere. Turns out it was on the RVM site itself. I point rvm to the ssl I have installed with macports --with-openssl-dir=/opt/local/usr/local, personally.



来源:https://stackoverflow.com/questions/9136694/rails-gemfile-defaults-to-https-bundle-install-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!