我刚安装了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。


当前回答

$ source ~/.rvm/scripts/rvm

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

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

其他回答

我在一个新的rvm安装中也遇到了这个问题,这里的答案都没有解决它。进入官方rvm站点,在基础部分,他们有这样的命令:

# from http://rvm.io/rvm/basics rvm env——path (rvm 1.9.3)

您应该将1.9.3更改为您真正想要的ruby版本,并且它将使rvm成为一个函数,而不考虑shell类型。

打开终端,然后去编辑>配置文件首选项,然后去标签“标题和命令”,并检查“运行命令作为登录Shell”。

启动一个Bash,现在你可以直接从终端安装Gems,而不使用sudo和错误“RVM不是一个函数,选择红宝石与' RVM使用…”将被淘汰。

欢呼。

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

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的更新版本。

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

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.

希望能有所帮助。干杯!

对于那些有同样问题的人,他们像我一样使用lubuntu,我点击了这个链接:

你以

lx终端-e“bash -il”

感谢@mpapsis给我指明了正确的方向