OS X Mavericks安装rvm警告

ste*_*iel 4 ruby terminal command-line rvm

在终端中运行时:

$ curl -L https://get.rvm.io | bash -s
Run Code Online (Sandbox Code Playgroud)

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

 * 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
Run Code Online (Sandbox Code Playgroud)

我不能使用RVM,得到错误

-bash: rvm: command not found'
Run Code Online (Sandbox Code Playgroud)

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

Moh*_*mad 9

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

从bash文档:

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

这意味着的是,/.bash_profile正在运行,/.profile以及/.bashrc被忽略.

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

  • 你想要找到这一行:`[[-s"$ HOME/.rvm/scripts/rvm"]] && source"$ HOME/.rvm/scripts/rvm"#Load RVM $`一旦你找到它`/ .bash_profile`复制它,然后将其粘贴到`/ .profile`中. (3认同)