RVM set ruby default, when open new terminal erase the RVM setting, go back to system ruby

China☆狼群 提交于 2019-12-04 05:49:09

If RVM is working in the shell but just isn't using the preferred ruby as default, set it with the following for 1.9.3:

rvm --default use 1.9.3

If RVM isn't working, it's likely a login shell problem that RVM isn't loading:

Login shells (typically when a terminal window is opened in an X window manager) will use .bash_profile but interactive, non-login shells reference .bashrc (likely where the rvm shell code are loaded).

Option 1

Cheap fix, symlink them:

ln -s ~/.bashrc ~/.bash_profile

Option 2

Optionally, some terminals (e.g. gnome-terminal) offer settings to force login shells for each new terminal session too.

Option 3

Create a .bash_login file with the following contents:

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

(Bash will check for ~/.bash_profile, then ~/.bash_login, and finally ~/.profile.)

See the bash man page for additional detailed information.

I'm not familiar with a .bashrc_profile file. I think you mean to have this line in your .profile or .bashrc file.

There are to things to check:

  1. go to terminal emulator, preferences, and enable login shell, sometimes it is required to use /bin/bash --login instead of just switching, put /bin/login would not work,

  2. one of ~/.bash* files might be resetting PATH, comment out any PATH=... lines.

After it is done make sure to open a new terminal (make sure to close it before).

Use this $ source $(rvm 1.9.3 do rvm env --path) and specify the version you want to use everytime you open a terminal. After you put that in you don't need to open another one because it will default back. So if you want to use v. 2.2.1 $ source $(rvm 2.2.1 do rvm env --path)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!