缺少OpenSSL库?

时间:2014-04-27 21:43:48

标签: ruby homebrew rbenv

我一直在尝试安装ruby 2.1.1但是当我在终端中运行它时,这就是我得到的:

$rbenv install 2.1.1

Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /Users/nthulanemakgato/.rbenv/versions/2.1.1

Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...

BUILD FAILED

Inspect or clean up the working tree at      /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140427221824.34053
Results logged to /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-       build.20140427221824.34053.log

Last 10 log lines:
                          io-console 0.4.2
                          json 1.8.1
                          minitest 4.7.5
                          psych 2.0.3
                          rake 10.1.0
                          rdoc 4.1.0
                          test-unit 2.1.1.0
installing rdoc:                    /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/ri/2.1.0/system
installing capi-docs:         /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/doc/ruby
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

所以我去了谷歌,搜索并尝试了一些类似的东西:

$brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.1f... Warning: Could not     link openssl.     Unlinking...
然后我试了

$ brew update
error: unable to unlink old '.gitignore' (Permission denied) error: unable to create file     CODEOFCONDUCT.md (Permission denied) error: unable to unlink old 'CONTRIBUTING.md' (Permission     denied) error: unable to create file LICENSE.txt (Permission denied) error: unable to unlink     old 'README.md' (Permission denied) error: unable to unlink old 'SUPPORTERS.md' (Permission     denied) Checking out files: 100% (1995/1995), done. Error: Failure while executing: git pull -    q origin refs/heads/master:refs/remotes/origin/master

$ brew upgrade ruby-build 

Error: ruby-build not installed

$brew install openssl

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-  1.0.1g.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.1g.mavericks.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

The OpenSSL provided by OS X is too old for some software.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

LDFLAGS:  -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include

Error: Failed to create: /usr/local/opt/openssl
Things that depend on openssl will probably not build.
==> Summary
  /usr/local/Cellar/openssl/1.0.1g: 429 files, 15M

最后,

$sudo brew install openssl
Password:
Error: Cowardly refusing to `sudo brew install`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

还有其他一些事情(除非你认为必要,否则我不会详细说明):

$CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.1.1
$CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv     install 2.1.1

并且都没有奏效。

我已经安装了xcode
我有OS X 10.9.2 安装了Homebrew OpenSSL 0.9.8y 2013年2月5日

我不明白发生了什么,我一直在努力解决这个问题,请帮忙 如果您需要更多信息以便提供帮助,请告诉我,我很乐意提供这些信息。

1 个答案:

答案 0 :(得分:1)

我在另一个网站找到了这个挑战的答案。

$rbenv install --patch 2.1.1

然后

$curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1

我从这个链接获得了这些信息: https://schwartzmeyer.com/2014/04/26/building-ruby-2-0-0-and-2-1-1-on-os-x/