通过 macports 安装了 fxruby,现在 ruby​​gems 坏了

发布于 2024-08-20 08:44:02 字数 1189 浏览 3 评论 0原文

安装了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘你却要生生世世 2024-08-27 08:44:02

如果您通过 macport 安装了 rb-fxruby,它也会安装 macport ruby​​。

$ port info rb-fxruby
...
Library Dependencies: ruby, fox, fxscintilla
...

但正如您所看到的,rb-rubygems(rubygems 的 macport 版本)未列为依赖项,因此您必须手动安装它。

$ sudo port install rb-rubygems

应该为你做。

If you installed rb-fxruby via macport it will install the macport ruby as well.

$ port info rb-fxruby
...
Library Dependencies: ruby, fox, fxscintilla
...

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.

$ sudo port install rb-rubygems

should do it for you.

黯然 2024-08-27 08:44:02

您似乎正在尝试使用 Apple 提供的与 Apple 提供的 ruby​​ 一起使用的 gem。你安装的是MacPorts版本吗?

sudo port install rb-rubygems
/opt/local/bin/gem

It looks like you are trying to use the Apple-supplied gem that works with the Apple-supplied ruby. Did you install the MacPorts version?

sudo port install rb-rubygems
/opt/local/bin/gem
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文