Search code examples
rubymacosopenssl

bundle install failed because of openssl


when I run bundle install , I get message bellow on console .

it seems all these message are related to openssl

how can I fix this error?


/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_LIBRARY_VERSION
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_VERSION_NUMBER
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::OPENSSL_FIPS
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::BN::CONSTTIME
/opt/homebrew/Cellar/ruby/3.2.0/lib/ruby/3.2.0/arm64-darwin22/openssl.bundle: warning: already initialized constant OpenSSL::Config::DEFAULT_CONFIG_FILE
/opt/homebrew/lib/ruby/site_ruby/3.2.0/rubygems.rb:322:in `clear_paths': undefined method `reset' for Gem::Security:Module (NoMethodError)

    Gem::Security.reset if defined?(Gem::Security)
                 ^^^^^^
    from /opt/homebrew/lib/ruby/site_ruby/3.2.0/bundler/rubygems_integration.rb:174:in `clear_paths'
     ...

i searched the internet about this but got little about this error


Solution

  • as @anothermh mentioned ,do not use brew to install ruby ,use rvm instead

    1. install rvm
    2. brew uninstall ruby
    3. install ruby and specify openssl path
    rvm install 3.2.0 --with-openssl-dir=$(brew --prefix openssl)
    

    it works for me