安装 Ruby 3.2.2 在 macOS M2 上使用 rbenv:遇到 psych 和 libyaml 缺失问题。

huangapple go评论40阅读模式
英文:

Installing Ruby 3.2.2 using rbenv on macOS M2: Missing psych and libyaml issues

问题

我在使用Mac上的M2 CPU上使用rbenv。我已经安装了Ruby 2.7.2,并希望安装Ruby 3.2.2。当运行"rbenv install 3.2.2"时,我遇到以下错误:

yaml.rb:3: warning: 似乎您的Ruby安装缺少psych(用于YAML输出)。
为了消除这个警告,请安装libyaml并重新安装Ruby。
Ruby的yaml扩展没有被编译。
错误:由于缺少扩展,Ruby安装中止
英文:

I am using rbenv on a Mac with an M2 CPU. I have ruby 2.7.2 installed and want to also install ruby 3.2.2. When running rbenv install 3.2.2, I get the following error:

yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
The Ruby yaml extension was not compiled.
ERROR: Ruby install aborted due to missing extensions

答案1

得分: 2

解决方案在错误消息中。您可能只需安装 libyaml

尝试:

brew install libyaml
英文:

The solution is in the error message. You probably just need to install libyaml

Try:

brew install libyaml

答案2

得分: 1

我在Ubuntu 22.04上遇到了完全相同的问题。
修复方法是:

gem uninstall psych
gem uninstall openssl

然后再尝试。

英文:

I had the exact same problem in Ubuntu 22.04.
What fixed it for me was

gem uninstall psych
gem uninstall openssl

and trying again

huangapple
  • 本文由 发表于 2023年4月7日 02:37:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952731.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定