通过 macports 安装了 fxruby,现在 rubygems 坏了
安装了 fxruby
$sudo port install rb-fxruby
我按照书中的建议
。它有效,我的 hello world 程序工作正常。
但现在,我编写的其他代码已损坏,每当我尝试使用任何依赖 gem 的代码时,它都不起作用。当我这样做时 $ruby -e“需要'rubygems'”
在我的代码中,它给出了
"LoadError: no such file to load — rubygems"
当我在 .bash_profile 中设置 RUBYOPT="rubygems"
时
$ruby -e "puts 'hello world'"
ruby: no such file to load -- ubygems (LoadError)
(它说“ubygems”,前面没有“r”,不知道为什么)
http://newsgroups.derkeiler.com/Archive/Comp/comp .lang.ruby/2008-08/msg00351.html 建议我根据红宝石位置检查我的宝石位置,我得到:
$cat `which gem` | head -n 1
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
$ls -l `which ruby`
-rwxr-xr-x 2 root admin 12680 Feb 7 03:40 /opt/local/bin/ruby
我认为这意味着宝石被混淆了,但不确定如何补救。有什么想法吗?没有宝石真是太可惜了
---更新---
忘记列出版本:
$which gem
/usr/bin/gem
$gem --version
1.3.5
$ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9]
I installed fxruby using
$sudo port install rb-fxruby
As suggested in the book.
It works, my hello world program worked correctly.
Now, though, other code that I have written is broken, whenever I try to use any code that relies on a gem, it does not work. When I do$ruby -e "require 'rubygems'"
in my code, it gives
"LoadError: no such file to load — rubygems"
When I set my RUBYOPT="rubygems"
in my .bash_profile
$ruby -e "puts 'hello world'"
ruby: no such file to load -- ubygems (LoadError)
(it says 'ubygems' without the 'r' on the front, not sure why)
http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.ruby/2008-08/msg00351.html suggests I check my gem location against my ruby location, I get:
$cat `which gem` | head -n 1
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
$ls -l `which ruby`
-rwxr-xr-x 2 root admin 12680 Feb 7 03:40 /opt/local/bin/ruby
I assume this means that the gems are confused, but not sure how to remedy it. Any ideas? It sucks not having gems.
---UPDATE---
Forgot to list versions:
$which gem
/usr/bin/gem
$gem --version
1.3.5
$ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您通过 macport 安装了 rb-fxruby,它也会安装 macport ruby。
但正如您所看到的,rb-rubygems(rubygems 的 macport 版本)未列为依赖项,因此您必须手动安装它。
应该为你做。
If you installed rb-fxruby via macport it will install the macport ruby as well.
But as you can see rb-rubygems (the macport version of rubygems) is not listed as a dependency, so you will have to install it manually.
should do it for you.
您似乎正在尝试使用 Apple 提供的与 Apple 提供的 ruby 一起使用的 gem。你安装的是MacPorts版本吗?
It looks like you are trying to use the Apple-supplied
gem
that works with the Apple-suppliedruby
. Did you install the MacPorts version?