在我运行“source ~/.profile”之前,RVM 无法被识别。在终端
sergio@sergio-VirtualBox:~/code$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
sergio@sergio-VirtualBox:~/code$ source ~/.profile
sergio@sergio-VirtualBox:~/code$ rails -v
Rails 3.2.1
知道为什么在我运行“source ~/.profile”之前该命令不起作用吗?我不想每次运行机器或打开新的终端窗口时都执行此操作。
sergio@sergio-VirtualBox:~/code$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
sergio@sergio-VirtualBox:~/code$ source ~/.profile
sergio@sergio-VirtualBox:~/code$ rails -v
Rails 3.2.1
Any ideas why the command doesn't work until I run "source ~/.profile"? I would like to not have to do this every time I run my machine or open a new terminal window.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RVM提供了很好的描述https://rvm.io/support/faq/#shell_login
你应该使用 .bash_profile - 除非你有充分的理由反对它 - 但我不知道很多。
Rvm 在您的一个 RC 文件中放置了一条源行,在您的情况下是 .profile,您应该删除该行,创建 .bash_profile,然后更新 rvm:
RVM provides quite good description https://rvm.io/support/faq/#shell_login
you should use .bash_profile - unless you have good reasons against it - but I do not know many.
Rvm puts a sourcing line in one of your RC files, in your case it was .profile, you should remove that line, create .bash_profile, and update rvm:
您的 shell 未加载您的 ~/.profile。可能它正在加载 ~/.bashrc 或 ~/.bash_profile 或其他一些可能的事情之一。请查阅您的 shell 文档,或者在
strace
下运行它以查看启动时加载的文件。Your shell isn't loading your ~/.profile. Probably it is loading ~/.bashrc or ~/.bash_profile or one of a few other possible things. Consult the documentation for your shell, or run it under
strace
to see what files it loads when it starts.