在我运行“source ~/.profile”之前,RVM 无法被识别。在终端

发布于 2025-01-01 09:28:59 字数 353 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我纯我任性 2025-01-08 09:28:59

RVM提供了很好的描述https://rvm.io/support/faq/#shell_login

你应该使用 .bash_profile - 除非你有充分的理由反对它 - 但我不知道很多。

Rvm 在您的一个 RC 文件中放置了一条源行,在您的情况下是 .profile,您应该删除该行,创建 .bash_profile,然后更新 rvm:

sed -i '/source.*rvm/ d' ~/.profile
touch ~/.bash_profile
rvm get head --auto-dotfiles

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:

sed -i '/source.*rvm/ d' ~/.profile
touch ~/.bash_profile
rvm get head --auto-dotfiles
夏末染殇 2025-01-08 09:28:59

您的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文