OpenSSL error installing ruby 2.0.0-p195 on Mac with rbenv

一世执手 提交于 2019-12-02 23:06:12

Try adding OpenSSL to the config options using the --with-openssl-dir option:

$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195

If you're using Homebrew, you'll need to install OpenSSL before running the above by running:

$ brew install openssl

UPDATE (see @JarkkoLaine 's comment below):

Just for the record, you should not need to use the config opts anymore with ruby-build and homebrew. However, I had to reinstall openssl with homebrew to make it work: brew uninstall openssl; brew upgrade; brew install openssl; rbenv install 2.0.0-p247. See this for more info.

I fixed this by executing:

brew link openssl --force

Mac OSX 10.9.4

Upgrading to the latest version of ruby-build fixed the problem for me:

Like the OP, I got

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?

but installing the latest version of ruby-build, via

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

fixed it.

Ruby-build had some changes between when the OP asked and now, which would explain why it worked for me, but not for the OP using the latest stable version of ruby-build.

Serge Seletskyy

For those who have problems installing openssl.

I had this error on my Mac 10.8.4

brew install openssl

created directory `/usr/local/Cellar/openssl/1.0.1e/include/openssl'
make: *** [install_sw] Error 13

READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/pull/19429
  1. Create a directory if it does not exist

    sudo mkdir /usr/local/etc/openssl
    
  2. Change the rights. Replace and with your name and group (e.g. serge:admin)

    sudo chown -R <username>:<group> /usr/local/etc/openssl/
    
  3. Repeat openssl installation

    brew install openssl
    
  4. Install curl-ca-bundle

    brew install curl-ca-bundle
    
  5. install ruby

    CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-p195
    

Bingo

Solution using ruby-install:

After uninstalling and installing openssl a couple of times (probably unnecessary) I successfully tried this:

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

The missing library is libssl*-dev* / openssl*-dev*, depending your distribution.

This issue came up again for me with Mac OS 10.9.5

Mac upgraded the command-line tools and that upgraded openssl, which broken rbenv.

I tried all of these solutions, but none of them worked. Everything was up-to-date, but I couldn't install any new gems or build rubies.

My solution was to:

  1. Remove the ruby version (for me it was 2.1.1)
  2. Brew uninstall ruby-build and rbenv
  3. Brew Re-install rbenv and ruby-build

Hope this helps you if you encounter it too!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!