所以我尝试使用rbenv安装ruby 2.5.0,这是我的问题:
$ rbenv install 2.5.0
ruby-build: use openssl from homebrew
Downloading ruby-2.5.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.0.tar.bz2
Installing ruby-2.5.0...
ruby-build: use readline from homebrew
BUILD FAILED (OS X 10.13.3 using ruby-build 20171226-3-g01e7b7b)
Inspect or clean up the working tree at /var/folders/6d/p9mv033d1xv9hc4xbdr7fxf40000gp/T/ruby-build.20180212121818.63339
Results logged to /var/folders/6d/p9mv033d1xv9hc4xbdr7fxf40000gp/T/ruby-build.20180212121818.63339.log
Last 10 log lines:
installing capi-docs:
/Users/lukeholloway/.rbenv/versions/2.5.0/share/doc/ruby
The Ruby OpenSSL extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/lukeholloway/.rbenv/versions/2.5.0
--with-openssl-dir=/usr/local/opt/openssl
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/lukeholloway/.rbenv/versions/2.5.0/lib
CPPFLAGS=-I/Users/lukeholloway/.rbenv/versions/2.5.0/include
这个问题似乎与Mac版本OpenSSL和Homebrew版本之间的路径。我在Mac上使用自制的所有内容。
所以这是我的openssl文件夹:
$ which openssl
/usr/local/opt/openssl/bin/openssl
$ openssl version
OpenSSL 1.0.2n 7 Dec 2017
我在我的.bash_profile
中有此行,以使其使用Homebrew安装的较新版本:
export PATH="/usr/local/opt/openssl/bin:$PATH"
现在似乎正在加载正确的OPENSL版本,但仍无法正确编译。它使用任何版本的Ruby进行此操作。
有人知道发生了什么事吗?任何帮助都很棒!
我升级自制后发生了这个错误。
我只是花了2天的时间来解决此错误,基本上重新安装了所有内容。这就是我找到解决方案的方式(tl; tr我很愚蠢(
- 运行
brew doctor
- 它说:"您的Xcode版本太老了,您使用的是9.0,最新版本为10.0"
- 我去了App Store,打开更新选项卡,没有任何地方
- 搜索Xcode并注意到版本10可用
- 安装后打开Xcode
- 运行
rbenv install 2.5.0
并工作。 - 讨厌我所有的生存。