如何使用 RVM 将 Ruby 更改为 1.9.3 版(再次)? [英] How can I change Ruby to version 1.9.3 (again) with RVM?

查看:28
本文介绍了如何使用 RVM 将 Ruby 更改为 1.9.3 版(再次)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经在 Ubuntu 上使用 Ruby 1.9.3 版,并做了一个更新,这可能会破坏我的 bash 配置文件,我需要帮助将其转回,而不是使用 1.8.7 版.现在 rails s 使用 Ruby 1.8.7 打开服务器,并且由于我在应用程序中使用的新语法而出现错误.

I used to work with Ruby version 1.9.3 on Ubuntu and made an update that probably screwed my bash profile and I need help to turn it back rather than using version 1.8.7. Right now rails s opens the server with Ruby 1.8.7 and I get errors because of the newer syntax I use in my app.

.bash_profile:

cat ~/.bash_profile

### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"

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

哪个导轨:

/usr/local/bin/rails

哪个红宝石:

/usr/bin/ruby

ruby -v:

ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]

rvm 列表:

rvm rubies

=* ruby-1.9.3-p194 [ i686 ]

# => - current
# =* - current && default
#  * - default

rvm 使用 1.9.3:

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

推荐答案

您不在登录 shell 中.要进入登录 shell,请尝试以下命令:

You are not in the login shell. To enter the login shell try this command:

/bin/bash --login

之后您就可以使用 RVM 来选择 Ruby.

After that you will be able to use RVM to select Ruby.

另外,有一个永久的方法,你不必每次打开终端时都写这一行.试试这个:

Also, there is permanent way, that you won't have to write this line everytime you open your terminal. Try this:

Edit menu -> Profile Preferences 

会出现一个对话框,现在选择Run command in login shell.

A dialog will appear, now select Run command in login shell.

之后,无论何时打开终端,都会进入登录shell,然后就可以使用RVM了.

After that, whenever you open your terminal, you will enter into the login shell, and you will be able to use RVM.

还有另一种方法,你可以在你的 .bash_profile 中写入 /bin/bash --login ,它会在你每次重启时加载.

There is another way, you can write /bin/bash --login in your .bash_profile which will load every time when you reboot.

这篇关于如何使用 RVM 将 Ruby 更改为 1.9.3 版(再次)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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