使用 Homebrew 安装 Ruby [英] Installing Ruby with Homebrew

查看:44
本文介绍了使用 Homebrew 安装 Ruby的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Homebrew 安装了 Ruby:

I installed Ruby with Homebrew:

brew install ruby

在注意事项"下它说:

注意:默认情况下,gem 安装的二进制文件将放置在:
/usr/local/Cellar/ruby/1.9.3-p194/bin

NOTE: By default, gem installed binaries will be placed into:
/usr/local/Cellar/ruby/1.9.3-p194/bin

您可能希望将其添加到您的 PATH 中.

You may want to add this to your PATH.

这是什么意思,我如何将它添加到我的路径"中?假设它与 bash_profile 有关,但这是新的.

What does that mean and how can I add it to my "path"? Assuming it has to do with a bash_profile but new to this.

推荐答案

~/.bash_profile 添加下面一行

export PATH=/usr/local/Cellar/ruby/1.9.3-p194/bin:$PATH

完成后,关闭终端并重新打开它.你应该没事.

When you're done, close your terminal and re-open it. You should be fine.

或者,您可以在每个打开的 shell 中执行以下操作,而不是关闭/重新打开:

Alternatively, you can execute the follwing in each open shell instead of closing/re-opening:

source ~/.bash_profile

注意:我强烈建议通过 rvmrbenv 以便您可以管理多个 ruby​​ 版本并使用 gemset.

Note: I highly recommend installing ruby via rvm or rbenv so you can manage multiple ruby versions and use gemsets.

这篇关于使用 Homebrew 安装 Ruby的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆