背景
最近换了新的笔记本,需要重新配置一下环境,记录一下在配置环境中遇到的 ruby 安装的坑。
问题描述
使用 fvm install 的命令安装 ruby 的时候报错:
tatemin@TATEMIN-MC5:~ % rvm install 3.0.0
Checking requirements for osx.
Certificates bundle '/opt/homebrew/etc/openssl@1.1/cert.pem' is already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/tatemin/.rvm/rubies/ruby-3.0.0, this may take a while depending on your cpu(s)...
ruby-3.0.0 - #downloading ruby-3.0.0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 18.6M 100 18.6M 0 0 3758k 0 0:00:05 0:00:05 --:--:-- 4702k
ruby-3.0.0 - #extracting ruby-3.0.0 to /Users/tatemin/.rvm/src/ruby-3.0.0.....
ruby-3.0.0 - #configuring..........................................................................
ruby-3.0.0 - #post-configuration.
ruby-3.0.0 - #compiling..............................................................................................................................................................................................-
Error running '__rvm_make -j12',
please read /Users/tatemin/.rvm/log/1705400623_ruby-3.0.0/make.log
There has been an error while running make. Halting the installation.
查看 make.log 日志:
问题修复
各种查找以后,发现并没有什么有效的解决方案,最后还是先卸载了 openssl@3 以后,重新安装后成功:
原因是因为 ruby 的编译会用到 openssl,如果存在 openssl@3 的话可能会导致一些变量依赖产生错误,从日志里面可以看到,虽然编译前指定了 openssl@1.1,但是头文件最后还是会找到:
/opt/homebrew/Cellar/openssl@3/3.2.0_1/include/ 路径