【问题标题】:Error while installing Ruby 2.3.7 in mac os 10.15.5 Catalina using RVM; OpenSSL not found使用 RVM 在 mac os 10.15.5 Catalina 中安装 Ruby 2.3.7 时出错;未找到 OpenSSL
【发布时间】:2020-06-09 17:37:18
【问题描述】:

我正在尝试使用以下命令安装 ruby​​

source ~/.rvm/scripts/rvm
rvm install 2.3.7

我尝试在 MacOs Catalina 10.15.5 中安装 ruby​​ 2.3.7 时遇到此错误

rvm install 2.3.7
Warning, new version of rvm available '1.29.10', you are using older version '1.29.9'.
You can disable this warning with:   echo rvm_autoupdate_flag=0 >> ~/.rvmrc
You can enable auto-update with:     echo rvm_autoupdate_flag=2 >> ~/.rvmrc
You can update manually with:        rvm get VERSION                         (e.g. 'rvm get stable')

Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.15/x86_64/ruby-2.3.7.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system..........
Installing required packages: openssl.
Updating certificates bundle '/usr/local/etc/openssl@1.1/cert.pem'
Requirements installation successful.
Installing Ruby from source to: /Users/pusingh/.rvm/rubies/ruby-2.3.7, this may take a while depending on your cpu(s)...
ruby-2.3.7 - #downloading ruby-2.3.7, this may take a while depending on your connection...
ruby-2.3.7 - #extracting ruby-2.3.7 to /Users/pusingh/.rvm/src/ruby-2.3.7.....
ruby-2.3.7 - #configuring...........................................................
ruby-2.3.7 - #post-configuration.
ruby-2.3.7 - #compiling..............................................................
ruby-2.3.7 - #installing.........
ruby-2.3.7 - #making binaries executable..
ruby-2.3.7 - #downloading rubygems-3.0.8
ruby-2.3.7 - #extracting rubygems-3.0.8......
ruby-2.3.7 - #removing old rubygems.........
$LANG was empty, setting up LANG=en_US.US-ASCII, if it fails again try setting LANG to something sane and try again.
ruby-2.3.7 - #installing rubygems-3.0.8..
Error running 'env GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@global GEM_PATH= /Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby -d /Users/pusingh/.rvm/src/rubygems-3.0.8/setup.rb --no-document',
please read /Users/pusingh/.rvm/log/1591718224_ruby-2.3.7/rubygems.install.log

这是 ruby​​gems.install.log 文件的输出 -

Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby
current path: /Users/pusingh/.rvm/src/rubygems-3.0.8
GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@pm
PATH=/Users/pusingh/.rvm/usr/bin:/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/pusingh/.rvm/gems/ruby-2.3.7@pm/bin:/Users/pusingh/.rvm/gems/ruby-2.3.7@global/bin:/Users/pusingh/.rvm/rubies/ruby-2.3.7/bin:/Users/pusingh/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
GEM_PATH=/Users/pusingh/.rvm/gems/ruby-2.3.7@pm:/Users/pusingh/.rvm/gems/ruby-2.3.7@global
command(7): env GEM_HOME=/Users/pusingh/.rvm/gems/ruby-2.3.7@global GEM_PATH= /Users/pusingh/.rvm/rubies/ruby-2.3.7/bin/ruby -d /Users/pusingh/.rvm/src/rubygems-3.0.8/setup.rb --no-document
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems.rb:1242 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems.rb:1251 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /Users/pusingh/.rvm/rubies/ruby-2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- did_you_mean
/Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- openssl (LoadError)
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/specification.rb:2481:in `to_ruby'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:405:in `install_default_bundler_gem'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/commands/setup_command.rb:167:in `execute'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command.rb:321:in `invoke_with_build_args'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:184:in `process_args'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/command_manager.rb:148:in `run'
    from /Users/pusingh/.rvm/src/rubygems-3.0.8/lib/rubygems/gem_runner.rb:59:in `run'
    from setup.rb:41:in `<main>'

open ssl 版本是 OpenSSL> 版本 LibreSSL 2.8.3

请帮忙,因为我不确定出了什么问题

【问题讨论】:

    标签: ruby openssl rvm


    【解决方案1】:

    this issue comment

    看起来旧的 ruby​​ 版本需要旧版本的 openSSL,并且必须使用指向 --with-openssl-dir 的那个版本来构建它

    你可以试试这个:

    brew install rbenv/tap/openssl@1.0
    
    PKG_CONFIG_PATH=/usr/local/Cellar/openssl@1.0/1.0.2t/lib/pkgconfig \
    rvm install 2.3.7 \
    --with-openssl-dir=/usr/local/Cellar/openssl@1.0/1.0.2t \
    --with-openssl-lib=/usr/local/Cellar/openssl@1.0/1.0.2t/lib \
    --with-openssl-include=/usr/local/Cellar/openssl@1.0/1.0.2t/include --rubygems ignore
    

    【讨论】:

      【解决方案2】:

      对于旧版本的 ruby​​,您可能希望使用像这样的 docker + docker-compose 开发工作流程。 https://rollout.io/blog/running-rails-development-environment-docker/

      您应该能够以这种方式安装 ruby​​ 2.3,并且您不必处理这些类型的奇怪错误,而且您将学习 docker。您应该能够开发并看到图像中的变化。 IIRC 唯一的问题是您需要运行新的 docker-compose 构建的 gem 更改。

      https://rollout.io/blog/running-rails-development-environment-docker/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-11-02
        • 2020-05-11
        • 1970-01-01
        • 2021-03-02
        • 2023-03-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多