我在进入 ubuntu 后每次都要输入 source /etc/profile.d/rvm.sh 系统才能识别我 ruby rails rvm 这些命令,请问是不是我哪里没有设置?
#1 楼 @song940 +1 echo "source /etc/profile.d/rvm.sh " >> .bashrc #5 楼 @chunlea +1 参考 http://rvm.io/integration/gnome-terminal
最简单的方案就是
echo "source /etc/profile.d/rvm.sh " >> ~/.bashrc
如果你用的是 bash(估计你用的一定是 bash)
那么你可以看看帮助文档 man bash
INVOCATION 部分
了解一下 bash 和 ~/.bashrc 和 .bash_profile 的关系
Multi-User:
The rvm function will be automatically configured for every user on the system if you install with sudo. This is accomplished by loading /etc/profile.d/rvm.sh on login. Most Linux distributions default to parsing /etc/profile which contains the logic to load all files residing in the /etc/profile.d/ directory. Once you have added the users you want to be able to use RVM to the rvm group, those users MUST log out and back in to gain rvm group membership because group memberships are only evaluated by the operating system at initial login time.
#17 楼 @shangrenzhidao 用 root 安装不是装在 root 下,而是装成 multi-user 模式。我现在都用 single-user 模式了,记不太清楚要怎么弄。
root 是个特殊的用户,如果搞不清楚的话还是不要用,不过你可以趁机搞明白 root 和 sudo 跟 Linux 用户权限的问题。
Note: The Multi-User install instructions must be prefixed with the 'sudo' command. However, once the install is complete, and the instructions to add users to the rvm group is followed, the use of either sudo or rvmsudo is no longer required. The 'sudo' command is only to temporarily elevate privileges so the installer can complete it's work. If you need to use 'sudo' or 'rvmsudo' after the install is complete, some part of the install directions were not properly followed. This usually is because people execute the install as root, rather than executing the installation instructions from a non-privileged user account.
这里说用 sudo 安装跟用 root 安装还不一样,root 会导致一些问题。
正常 multi-user 模式是普通用户用 sudo 安装,然后将用户加到 rvm 组,之后不需要 sudo 或 rvmsudo。
我建议是用 single-user 模式。