Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I just got a new MacBook Pro and tried to setup the RVM in the system. I installed RVM and set the default to

➜ rvm list default

Default Ruby (for new shells)

ruby-1.9.3-p194 [ x86_64 ]

My RVM version is

➜ rvm --version

rvm 1.16.8 (master) by Wayne E. Seguin , Michal Papis [https://rvm.io/]

I have put [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session. at the bottom of the .bashrc_profile.

When I open the new Terminal window, I have done rvm default every time to reset from system ruby to rvm installed ruby.

I have done 3 hours research and read more than 20 different blogs about this issue. And I still do not have a solution for this problem.

like image 929
MMA Avatar asked Oct 04 '12 01:10

MMA


People also ask

How do I remove ruby from RVM?

Removing Rubies. There are two ways to remove rubies from rvm: rvm remove # Removes the ruby, source files and optional gemsets / archives. rvm uninstall # Just removes the ruby - leaves everything else.

What is RVM terminal?

RVM is a command-line tool for managing multiple ruby versions and also uses a separate gemset for each rails app. RVM is a command-line tool that allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.

How do I change the default ruby on Mac?

To set a default Ruby version with rvm, enter rvm --default use 3.0. 0 on the command line. To switch to the system ruby, enter rvm use system . To switch back to the default, rvm default .


2 Answers

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.

like image 173
Nick Avatar answered Sep 28 '22 10:09

Nick


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

like image 28
pje Avatar answered Sep 28 '22 12:09

pje