gpt4 book ai didi

ruby - Homebrew 安装 Ruby keg-only 找不到 gem

转载 作者:数据小太阳 更新时间:2023-10-29 07:26:36 24 4
gpt4 key购买 nike

在使用 Homebrew 安装 Ruby 后,如何让 irb 工作?

当我尝试运行 irb 时,出现错误:

$ irb
Traceback (most recent call last):
2: from /usr/local/opt/ruby/bin/irb:23:in `<main>'
1: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/usr/local/lib/ruby/site_ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb (Gem::GemNotFoundException)

我试过:

$ brew link ruby
Warning: Refusing to link macOS-provided software: ruby
If you need to have ruby first in your PATH run:
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile

For compilers to find ruby you may need to set:
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"

我的 /etc/paths 文件顶部有以下几行:

/usr/local/bin
/usr/local/opt/ruby/bin
/usr/local/lib/ruby/gems/2.6.0/bin

irb 没有出现在 gem list 的输出中,但是:

$ find /usr/local -name irb
/usr/local/lib/ruby/2.6.0/irb
/usr/local/Cellar/ruby/2.6.0_1/bin/irb
/usr/local/Cellar/ruby/2.6.0_1/lib/ruby/2.6.0/irb
/usr/local/Cellar/ruby/2.6.0_1/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb
/usr/local/Cellar/ruby/2.6.0_1/share/ri/2.6.0/system/lib/irb

我对 rirdoc 也有类似的问题。

最佳答案

运行:gem install irb 现在可以开始了。

关于ruby - Homebrew 安装 Ruby keg-only 找不到 gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54393939/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com