Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用rbenv在Mac上安装ruby 2.0.0-p195时出现OpenSSL错误_Ruby_Homebrew_Rbenv - Fatal编程技术网

使用rbenv在Mac上安装ruby 2.0.0-p195时出现OpenSSL错误

使用rbenv在Mac上安装ruby 2.0.0-p195时出现OpenSSL错误,ruby,homebrew,rbenv,Ruby,Homebrew,Rbenv,我试图在Mac(Mountain Lion)上使用rbenv安装Ruby 2.0.0-p195,但出现了此错误 BUILD FAILED Inspect or clean up the working tree at /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669 Results logged to /var/folders/vt/27n8h2yj27v7rzq58075f3_m00

我试图在Mac(Mountain Lion)上使用rbenv安装Ruby 2.0.0-p195,但出现了此错误

BUILD FAILED

Inspect or clean up the working tree at /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669
Results logged to /var/folders/vt/27n8h2yj27v7rzq58075f3_m0000gn/T/ruby-build.20130618163859.1669.log

Last 10 log lines:
installing default gems:      /Users/me/.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                              bigdecimal 1.2.0
                              io-console 0.4.2
                              json 1.7.7
                              minitest 4.3.2
                              psych 2.0.0
                              rake 0.9.6
                              rdoc 4.0.0
                              test-unit 2.0.0.0
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
当我运行brew安装openssl时,它说

Warning: openssl-1.0.1e already installed
按照这个线程上的解决方案,我尝试以这种方式安装最新的stable,但得到了相同的错误

env CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline`" rbenv install 2.0.0-p195

有什么想法吗?

尝试使用带有OpenSSL目录的选项将OpenSSL添加到配置选项中:

$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
如果您使用的是自制软件,则需要先安装OpenSSL,然后再运行以下程序:

$ brew install openssl
更新(见下面@JarkkoLaine的评论):


只是为了记录,您不需要使用配置选项 不再使用ruby构建和自制。然而,我不得不重新安装 使用自制的openssl使其正常工作:brew卸载openssl;酿造 升级brew安装openssl;rbenv安装2.0.0-p247。寻找 更多信息


对于那些在安装openssl时遇到问题的用户

我的Mac 10.8.4出现了这个错误

brew安装openssl
已创建目录“/usr/local/ceral/openssl/1.0.1e/include/openssl”
make:**[安装软件]错误13
请阅读以下内容:https://github.com/mxcl/homebrew/wiki/troubleshooting
这些未决问题也可能有助于:
https://github.com/mxcl/homebrew/pull/19429
  • 创建一个不存在的目录

    sudo mkdir/usr/local/etc/openssl
    
  • 改变权利。将和替换为您的姓名和组(例如serge:admin)

    sudo chown-R:/usr/local/etc/openssl/
  • 重复openssl安装

    brew安装openssl
    
  • 安装卷曲ca束

    brew安装卷曲ca包
    
  • 安装ruby

    CONFIGURE_OPTS=“--with openssl dir=`brew--prefix openssl`”rbenv安装2.0.0-p195
    

  • 宾果游戏升级到最新版本的ruby build解决了我的问题:

    就像这次行动一样,我得到了

    BUILD FAILED
    
    Inspect or clean up the working tree at /Users/me/.rbenv/sources/2.0.0-p247
    Results logged to /var/folders/3x/y_8y8vr53ws_kxj97km79q5h0000gn/T/ruby-build.20130704172404.3106.log
    
    Last 10 log lines:
    installing default gems:      /Users/me/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
                                  bigdecimal 1.2.0
                                  io-console 0.4.2
                                  json 1.7.7
                                  minitest 4.3.2
                                  psych 2.0.0
                                  rake 0.9.6
                                  rdoc 4.0.0
                                  test-unit 2.0.0.0
    The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
    
    但是安装最新版本的ruby build,通过

    # Don't forget brew doctor and brew update if required
    brew upgrade ruby-build
    
    修好了


    Ruby build在OP询问时和现在之间有一些更改,这可以解释为什么它对我有效,但对使用最新稳定版本Ruby build的OP无效。

    缺少的库是libssl*-dev*/openssl*-dev*,具体取决于您的发行版。

    我通过执行以下命令修复了此问题:

    brew link openssl --force
    

    Mac OSX 10.9.4

    这个问题在我使用Mac OS 10.9.5时再次出现

    Mac升级了命令行工具,并升级了openssl,这破坏了rbenv

    我尝试了所有这些解决方案,但没有一个奏效。一切都是最新的,但我不能安装任何新的宝石或建立红宝石

    我的解决办法是:

  • 删除ruby版本(对我来说是2.1.1)
  • Brew卸载ruby build和rbenv
  • Brew重新安装rbenv和ruby build

  • 希望这能帮助你,如果你也遇到它

    使用ruby安装的解决方案:

    卸载和安装openssl几次后(可能没有必要),我成功地尝试了以下方法:

    ruby-install ruby 2.1.3 -- --with-openssl-dir=`brew --prefix openssl`
    

    确保运行
    brew update
    更新公式,以便在升级/安装时获得最新版本的
    ruby build
    )@electblake我注意到上面的“brew upgrade ruby build”命令.我刚刚安装了最新的brew,带有rbenv和ruby build,但不幸的是,这不起作用…投票通过了,因为升级ruby build为我解决了这个问题!我是通过git(不是Brew)安装rbenv的,但是我在运行“rbenv安装2.0.0-p353”时直接升级了rbenv和ruby build,这与@Andrew的做法基本相同:
    $cd~/.rbenv
    $git pull
    $git pull
    发生的第一件事是安装了新版本的openssl,ruby安装运行良好。作为一个附带的好处,升级ruby build还更新了我的可安装ruby版本列表。实际上,我是在运行brew install openssl的情况下执行这些步骤的,我想目录是及时生成的,因为在它通常失败的时候,brew安装一直在进行!BingoI还必须执行
    brew安装curl ca bundle;导出SSL_CERT_FILE=/usr/local/opt/curl ca bundle/share/ca bundle.crt
    以使其正常工作。为了记录在案,您不需要在ruby build和homebrew中再使用配置选项。然而,我不得不用homebrew重新安装openssl以使其正常工作:
    brew卸载openssl;brew升级;brew安装openssl;rbenv安装2.0.0-p247
    。有关详细信息,请参阅。@JarkkoLaine通过自制重新安装openssl的解决方案为我解决了这个问题(重新安装后,我也不需要设置env变量)。我怀疑这可能与我最近升级到OSXMavericks有关,它修改了/usr/local中的许多文件权限和所有权。也许你可以考虑把这个评论推广到一个答案,让它更容易被发现。FWIW,他在OSX上,而不是Linux发行版。这个小东西救了我一个通宵,谢谢。MUCH@stopshinal很高兴它有帮助!