OS X Mavericks安装rvm警告

在终端中运行时:

$ curl -L https://get.rvm.io | bash -s 

它似乎工作正常,但最后在升级说明中说

  * WARNING: You have '~/.profile' file, you might want to load it, to do that add the following line to '/Users/steven/.bash_profile': source ~/.profile 

我不能使用RVM,得到错误

 -bash: rvm: command not found' 

我对终端和Ruby很新,所以任何帮助都会非常感激。

当你安装rvm时,它的路径会被添加到~/.bash_profile 。 如您所见,RVM会在安装过程中向您发出警告。 每次加载终端时都可以运行source ~/.profile ,但这是一个痛苦的问题。

来自bash文档:

当bash作为交互式登录shell或作为具有–login选项的非交互式shell调用时,它首先从文件/ etc / profile中读取并执行命令(如果该文件存在)。 在读取该文件之后,它按顺序查找〜/ .bash_profile,〜/ .bash_login和〜/ .profile,并从存在且可读的第一个读取和执行命令。

这意味着正在运行/.bashrc并且正在忽略/.profile/.bashrc

要解决此问题,只需打开.bash_profile并复制顶部的rvm路径并将其粘贴到.bashrc文件的顶部。 打开一个新的终端窗口,它应该工作得很好。 您可以删除.bash_profile ,如果它是空的,或者如果您选择保留它,则将~/.profile的内容复制并粘贴到其中。

按照指示说。

从RVM故障排除页面 。

如果您的.bash_profile未在OSX上正确加载,则需要执行以下三项操作之一:

 Create a file named ~/.bash_profile and add the RVM source line there Add the RVM source line to ~/.profile In your terminal preferences, change the shell from the default of /usr/bin/login to /bin/bash. 

因此,请检查系统中是否有/Users/steven/.bash_profile 。 如果存在,请打开文件并在文件末尾添加该行:

source ~/.profile

否则创建文件并添加它。