現象
$ gem install rails
をすると以下のエラーがでた。
ERROR: Loading command: install (LoadError)
dlopen(/Users/ikemonn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle, 9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /Users/ikemonn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
Reason: image not found - /Users/ikemonn/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-darwin13.0/openssl.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
openssl自体はインストールしてあるのだが、Libraryをロードしている下記のパスがPC上に存在していなかった。
9): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
解決策
$ brew link openssl --force
参考
ruby - OpenSSL, RVM, Brew, conflicting error - Stack Overflow