如何使用RVM将Ruby更改为1.9.3版(再次)?

时间:2022-08-24 07:00:33

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.

我曾经在Ubuntu上使用Ruby版本1.9.3并进行了更新,可能搞砸了我的bash配置文件,我需要帮助才能将其转回而不是使用版本1.8.7。现在rails使用Ruby 1.8.7打开服务器,因为我在我的应用程序中使用了更新的语法而出现错误。

.bash_profile:

.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*

which rails:

哪个铁轨:

/usr/local/bin/rails

which ruby:

哪个红宝石:

/usr/bin/ruby

ruby -v:

ruby -v:

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

rvm list:

rvm列表:

rvm rubies

=* ruby-1.9.3-p194 [ i686 ]

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

rvm use 1.9.3:

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.

1 个解决方案

#1


15  

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

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

/bin/bash --login

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

之后,您将能够使用RVM选择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 

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

将出现一个对话框,现在在登录shell中选择Run命令。

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

之后,无论何时打开终端,您都将进入登录shell,并且您将能够使用RVM。

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

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

#1


15  

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

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

/bin/bash --login

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

之后,您将能够使用RVM选择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 

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

将出现一个对话框,现在在登录shell中选择Run命令。

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

之后,无论何时打开终端,您都将进入登录shell,并且您将能够使用RVM。

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

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