本文介绍了自制软件安装Ruby Keg-only找不到gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用Homebrew安装Ruby后,如何使irb
工作?
How do I get irb
to work after installing Ruby with Homebrew?
当我尝试运行irb
时,出现错误:
When I try to run irb
, I get an error:
$ 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
文件顶部下面有几行:
I have the lines below at the top of my /etc/paths
file:
/usr/local/bin
/usr/local/opt/ruby/bin
/usr/local/lib/ruby/gems/2.6.0/bin
irb
不会显示在gem list
的输出中,但是:
irb
doesn't show up in the output of gem list
, but:
$ 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
我在ri
& rdoc
.
推荐答案
运行:gem install irb
,现在您可以开始使用了.
Run: gem install irb
and you now good to go.
这篇关于自制软件安装Ruby Keg-only找不到gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!