在 Mac 1.9.2 上安装 Ruby,即使路径更改,仍然得到 1.8.7

发布于 2024-09-28 16:54:53 字数 553 浏览 0 评论 0原文

我的 Mac 运行的是 10.6.4 Snow Leopard,显然 ruby​​ 已准备就绪。但我是 Ruby 新手,正在尝试学习 Rails 框架,因此我决定安装最新版本 1.9.2。我按照此处的说明进行操作,但是在我编译并安装,当我运行 ruby -v 时,我仍然得到 1.8.7。任何人都可以帮助菜鸟吗?

当我使用 which ruby​​ 时,我得到 usr/local/bin/ruby,因此路径已更改并且是正确的。


更新

我似乎遇到了问题,因为我使用两个登录文件来设置路径(.bash_login 和 .profile)。您只能使用一个,并且将使用第一个存在且可读的。我最终切换到 RVM 并使用 .bash_login 将 RVM 加载到 shell 中。

I'm on a Mac running 10.6.4 Snow Leopard, and apparently ruby comes ready to go. But I'm new to Ruby, trying to learn the Rails framework, and so i decided to install the latest version 1.9.2. I followed the instructions here, but after I compile and install, when I run ruby -v I'm still getting 1.8.7. Anyone can help a noob out?

When I use which ruby I am getting usr/local/bin/ruby, so the path has changed and is correct.


UPDATE:

It seems I was having issues because I was using two login files to set my path (.bash_login and .profile). You can only use one, and the first one that exists and is readable will be used. I eventually switched to RVM and used .bash_login to load RVM into shell.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

倒带 2024-10-05 16:54:53

嗯,SW没有骗你。所以有些事情并不如你所期望的那样。

尝试 /usr/local/bin/ruby -v 并查看它是什么版本。

添加:另外,尝试locate ruby​​|more来查看ruby文件在您系统上的位置。

您可能需要更改路径才能使用新安装的 ruby​​ 副本。

添加了更多内容:您是否按照步骤 1 中的说明将路径添加到 ~/.profile 文件中?

更改 ~/.profile 文件后是否重新启动了终端会话? (退出并重新启动终端。)

Well, the sw isn't lying to you. So something is not as you expect.

Try /usr/local/bin/ruby -v and see what version it is.

Added: Also, try locate ruby|more to see where the ruby files are on your system.

You may need to change your path to use your newly installed copy of ruby.

Added more: did you add the Path to your ~/.profile file as the instructions tell you to do in step 1?

Did you restart your terminal session after changing the ~/.profile file? (Quit and restart terminal.)

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