ruby 2.0 rails gem 安装错误“无法加载此类文件 -- openssl"

问题描述:

我正在使用 osx 10.8.2 安装的 ruby 2.0 和....尝试运行 "sudo gem install rails"

I am using osx 10.8.2 installed ruby 2.0 and.... got this when trying to run "sudo gem install rails"

$ sudo gem install rails
ERROR:  Loading command: install (LoadError)
    cannot load such file -- openssl
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

我之前有 ruby​​ 1.9.x 和 rails 3.2.x 工作正常

I had ruby 1.9.x and rails 3.2.x working alright before

你得先安装OpenSSL再重新编译ruby:

You have to install OpenSSL first and recompile ruby again:

RVM:

rvm pkg install openssl
rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr