打开终端时正确的Ruby版本 [英] the correct Ruby version when opening a terminal

查看:53
本文介绍了打开终端时正确的Ruby版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次打开终端时,我的Ruby版本是错误的.我必须手动执行以下命令:

Each time I open a terminal my Ruby version is wrong. I am obliged to execute by hand the following command:

source /usr/local/rvm/scripts/rvm

我读到RVM不会修改.bashrc或.bash_profile,但是我注意到.bashrc在结尾处:

I read that RVM doesn't modify .bashrc or .bash_profile but I note that my .bashrc has at the end:

PATH=$PATH:$HOME/.rvm/bin

不仅我自己没有插入此行,而且rvm的路径也是错误的!我更改了:

Not only I didn't insert this myself but the path to rvm is wrong ! I changed by:

PATH=$PATH:/usr/local/rvm/bin

我重新打开了一个终端,但是Ruby版本总是错误的!

I reopened a terminal but the Ruby version is always wrong !

推荐答案

rvm确实会修改.bash_profile/.bashrc,这是它的弱点之一.特别是,它添加(应该添加)此行以将rvm加载为shell函数:

rvm does modify your .bash_profile / .bashrc -- that's one of its weaknesses. In particular, it adds (is supposed to add) this line to load rvm as a shell function:

# Load RVM into a shell session as a function
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

即使在rvm中更改了全局默认值后,我也遇到了与运行错误的ruby版本有关的类似问题-确保此行是在.bash_profile的末尾修复的.无论如何,应该在该行中使rvm正常工作.

I had a similar issue with the wrong ruby version running even after I changed the global default in rvm--ensuring this line was at the end of my .bash_profile fixed it. In any case, that line's supposed to be there for rvm to work properly.

这篇关于打开终端时正确的Ruby版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆