Ruby 使用 rbenv 在 MacOS 上安装 2.6.0 失败

Ruby 2.6.0 installation fails on MacOS with rbenv

我在 Mojave 上有一个 Mac,它无法安装开发所需的一些基本内容:

$ rbenv install 2.6.0

Downloading openssl-1.1.1d.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
Installing openssl-1.1.1d...

BUILD FAILED (OS X 10.14.6 using ruby-build 20191223)

Inspect or clean up the working tree at /var/folders/l_/xgbzwc3j0xn_cb74550m71vr0000gn/T/ruby-build.20191225225406.18503.lq8QNM
Results logged to /var/folders/l_/xgbzwc3j0xn_cb74550m71vr0000gn/T/ruby-build.20191225225406.18503.log

Last 10 log lines:
      _s_server_main in s_server.o
  "_verify_stateless_cookie_callback", referenced from:
      _s_server_main in s_server.o
  "_wait_for_async", referenced from:
      _s_client_main in s_client.o
      _sv_body in s_server.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [apps/openssl] Error 1
make: *** [all] Error 2

我发现有几篇博文谈论 Mojave 版本如何为开发人员带来一些问题,但是 none 的文章提供了解决方案。还有其他人遇到过上述问题吗?

重新发布我对 this other thread 的回复 - 我遇到了类似的问题,可以推荐以下与 binutils 相关的方法需要 uninstall 编辑第一。什么对我有用:

brew uninstall binutils
# Uninstalling /usr/local/Cellar/binutils/2.33.1... (134 files, 167.6MB)

rbenv install 2.6.5 && rbenv local 2.6.5 ;
# Downloading openssl-1.1.1d.tar.gz...
# -> https://dqw8nmjcqpjn7.cloudfront.net/1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2
# Installing openssl-1.1.1d...
# Installed openssl-1.1.1d to /Users/auser/.rbenv/versions/2.6.5

# Downloading ruby-2.6.5.tar.bz2...
# -> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
# Installing ruby-2.6.5...
# ruby-build: using readline from homebrew
# Installed ruby-2.6.5 to /Users/auser/.rbenv/versions/2.6.5

在此之前,我还在 ruby-build.log 中收到许多不同的消息 - 最后一条是:

# ld: symbol(s) not found for architecture x86_64

我在自制程序设置(卸载之前)中采取的一些其他步骤包括:

brew install perl ruby rbenv
# // UPDATE PATHs with suggestions made by brew during install
which awk perl
# /usr/local/bin/awk
# /usr/local/bin/perl
# ^^^ IN SHORT ALL PATHs should be with /usr/local/opt OR /usr/local/bin

您可以根据需要再次重新安装 binutils,并记住对您可能会重新执行的任何未来 rbenv install 版本重复卸载(自我注意)。

PS - 在 macOS Catalina 10.15.3 (19D76) 上测试成功安装 2.4.0 和 2.6.5