【问题标题】:RVM isn't recognized until I run "source ~/.profile" in terminal在终端中运行“source ~/.profile”之前,无法识别 RVM
【发布时间】:2012-02-02 03:08:55
【问题描述】:
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”之前该命令不起作用吗?我不想每次运行我的机器或打开一个新的终端窗口时都这样做。

【问题讨论】:

    标签: linux ubuntu rvm profile


    【解决方案1】:

    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
    

    【讨论】:

    【解决方案2】:

    你的 shell 没有加载你的 ~/.profile。可能它正在加载 ~/.bashrc 或 ~/.bash_profile 或其他一些可能的事情之一。请查阅您的 shell 的文档,或在 strace 下运行它以查看它在启动时会加载哪些文件。

    【讨论】:

    • 你能像我五岁一样为我拼写出来吗,我对 Linux 不太熟悉。我只用Ubuntu或Mint,没有命令行thingamijigs,我只是在学习。
    • 哦。我认为你应该问 SuperUser,因为这是一个编程网站,而你的不是真正的编程问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 1970-01-01
    • 1970-01-01
    • 2020-07-08
    • 2020-11-08
    相关资源
    最近更新 更多