我刚安装了RVM,但是不能让它工作。我在我的.profile文件的末尾有这样的一行:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

我试图运行源.profile和重新启动终端,但仍然,当我运行rvm使用1.9.2时,我得到:

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

我的系统是Ubuntu 11.10。


当前回答

尽管你接受了一个答案,我还是想建议另一种方法。~ /。Bashrc在任何shell被打开之前被加载。在最后加上这一行,你不需要任何login shell的东西

其他回答

最新的RVM (RVM 1.11.6(稳定))在Ubuntu上停止工作(10.10 - 64位-讨厌的小虫子或其他什么)-我一直在得到

“RVM不是一个函数,用RVM use选择红宝石…’是行不通的。”

之前,我得到了消息,但是'rvm 1.9.3-p0@rails321'可以工作。现在,它不起作用了——你根本不能改变gemset。

什么都不工作,直到我发现这个-把它作为/home/your-name/.bashrc的最后一行

[[-s "$HOME/。rvm/scripts/rvm"]] && source "$HOME/.rvm/scripts/rvm"

$ source ~/.rvm/scripts/rvm

如果你不想一次又一次地为每个终端选项卡启用登录shell,请遵循以下步骤。

关于偏好 在这里输入图像描述 启用运行命令作为登录shell 在这里输入图像描述

正如您所说,所显示的错误可能是以下错误。

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command. 
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

如上所述,只需在您的终端中输入'/bin/bash——login'(重启终端后),然后键入命令'rvm use 1.9.3'(例如),它将开始使用相同的版本。

只需执行命令'ruby -v'来确认RVM使用的是ruby的更新版本。

要永久解决这个问题,只需剪切/粘贴以下代码行:

[[-s "$HOME/。rvm/scripts/rvm"]] && source "$HOME/.rvm/scripts/rvm"

来自:~ /。bash_profile文件

: ~ /。bashrc文件(

这样做的原因是每次进入终端时执行.bashrc,每次登录时执行.bash_profile。这就是为什么解决方案/bin/bash—login可以工作,但每次进入终端时都必须这样做。这样你就设置好了,直到你的下一个格式,你会忘记所有这些by than:)

以上答案都是正确的。但当我面对同样的问题时,解决方案如下:

Update ZSH. (Tried to update directly din't work for some reason. So uninstalled and reinstalled updated version from here) Set default shell as zsh (i.e. if you prefer zsh) using sudo chsh -s $(which zsh) $USER Ensure that the following code is at the bottom of your .zshrc after you have installed the latest RVM probably using CURL from official RVM site [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" source ~/.profile MOST IMPORTANT POINT: Ensure that in your .zshrc file every export to PATH is appended with :$PATH. Which i believe was the root of my problems even after following the above steps. post this all my problems of RVM Not being a function went away. If it still does not work, give some error trace over here. After a few hours of struggle to solve this issue, i'm sure i must have seen all related errors.

希望能有所帮助。干杯!